~sschwarzer/ftputil#54: 
Auto-increment functionality for stat cache

(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.

Status
RESOLVED FIXED
Submitter
schwa (unverified)
Assigned to
No-one
Submitted
13 years ago
Updated
13 years ago
Labels
enhancement library

schwa (unverified) 13 years ago · edit

Added in [a6dc2e9d826530ee076a7b8a1e35be3bfd7d9b22](https://git.sr.ht/~sschwarzer/ftputil/commit/a6dc2e9d826530ee076a7b8a1e35be3bfd7d9b22 "Added cache auto-resizing (see ticket #54). Ticket URL: ...").

schwa (unverified) 13 years ago · edit

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.

Register here or Log in to comment, or comment via email.