Make cache more effective by storing and using more information.
As shown by #108, the current stat cache implementation isn't enough for some cases. To avoid repeated failing accesses to a cache entry which we already "know" isn't there, add more information to the cache:
Directories and files that aren't in the remote file system. As explained in #108, this can happen if a directory or file is a non-existent target of a symlink. But it can also happen if user code explicitly accesses non-existent file system entries.
Empty directories. If we can already know that a directory is empty, we don't need to list it again.
Similarly, we may even store the stat information (or a subset) for a directory under the directory cache entry somehow. The idea would be to avoid "re-listing" the directory.
Of course, in addition to storing this information, we must extend the code to use this new information to avoid remote accesses.
We must be careful to invalidate/delete all the affected cache information if a directory or file is changed or deleted.