I assume it is not Total Commander that is caching the directory structure, or is it?
Probably not. If you have a large number of files, you can see the same effect if you open a command prompt and type something like
dir c:\abc.def /s You aren't likely to have any files with that name, but it takes a lot longer to finish the first time than it would take if you run it a second time immediately after.
It seems like an OS feature to me, or a hard drive cache.
Where and how exactly is it cached then? (ie. By which component's which mechanism, in which structure?)
Windows/NTFS would be caching the items and there will also be a cache in your hard-disk controller.
How do the system know that the cache is up-to-date or not?
Because the only way of writing to the hard-disk is by using routines that know and therefore update or invalidate the cache. For windows the routines are probably the NTFS device driver, whereas for the hard-disk, it is the disk-controller.
If it can be cached entirely, why is it not cached by default?
Because the cache is better used for other things. To cache it by default would mean
Every time the computer starts, it would have to read and store information on every file on your hard-disk regardless of whether it needed it. This can add a few seconds to your startup time. It is also quite common for people to have millions of files, which means the time could be significantly more.
That memory is not available for caching anything else especially the files you are really working on.
What happens if your profile/documents are stored on a server. Do you want the system to wait while it pulls the information on all your files across the network?
Also remember that just because everything can be cached, doesn't mean it should be cached. It can sometimes take longer to access information in an extremely large cache that in a smaller cache, which means that caching too much can actually slow you down. (By this I mean it is slower than when using smaller cache, but it would still be faster than using no cache)