Is there a solution for caching structure of the directory and for metadata of all the files? For example a have a huge collection of small files on my HDD and i want to "cache" all of it to an SSD in a way that i will store only information about the directory and necessary metadata, but when i want to actually access data from the file it will redirect to HDD
If you determined that whatever caching the OS does is insufficient then you can try ZFS with a special vdev for metadata (though beware, it's not cache).