(For some background on stat caching read the documentation.)
The default stat cache size is 1000 entries. Though this is enough for
most purposes, people from time to time run into the problem of
directories with more items than the default cache size. In this case,
old entries (further towards the top of the directory) are flushed out
to make place for newer stat items. Then, by the time the directory is
iterated over, the older entries are gone, so the directory listing is
fetched again for each stat call (isdir
, getmtime
etc.).
I've been thinking about just increasing the default stat cache size, but of course this costs memory which possibly isn't necessary. Maybe an auto-resize feature is a better approach.
Added in [a6dc2e9d826530ee076a7b8a1e35be3bfd7d9b22](https://git.sr.ht/~sschwarzer/ftputil/commit/a6dc2e9d826530ee076a7b8a1e35be3bfd7d9b22 "Added cache auto-resizing (see ticket #54). Ticket URL: ...").
Actually this feature should be called "auto-increment", not "auto-resize".
The cache size is never decreased automatically, but can be set with
FTPHost.stat_cache.resize
. Decreasing the cache size automatically could counter all the positive effects of the increase as ftputil can't know if the cached entries are still needed.