Ticket #54 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Auto-increment functionality for stat cache

Reported by: schwa Owned by: schwa
Priority: major Milestone: 2.6
Component: Library Version: 2.5
Keywords: cache, flushing, default size, stat Cc:

Description (last modified by schwa) (diff)

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

Change History

comment:1 Changed 3 years ago by schwa

  • Status changed from new to assigned
  • Type changed from defect to enhancement

comment:2 Changed 3 years ago by schwa

  • Description modified (diff)

comment:3 Changed 2 years ago by schwa

  • Status changed from assigned to closed
  • Resolution set to fixed

Added in [0fb499033581].

comment:4 Changed 2 years ago by schwa

  • Summary changed from Auto-resizing functionality for stat cache to Auto-increment functionality for stat cache

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.

Note: See TracTickets for help on using tickets.