Expand description
The raw cache module manages directories of read-only files
subject to a (batched) Second Chance eviction policy. Calling
prune deletes files to make sure a cache directory does not
exceed its capacity, in file count. The deletions will obey a
Second Chance policy as long as insertions and updates go through
insert_or_update or insert_or_touch, in order to update the
cached files’ modification times correctly. Opening the cached
file will automatically update its metadata to take that access
into account, but a path can also be touched explicitly.
This module implements mechanisms, but does not hardcode any policy… except the use of a second chance strategy.
Functions§
- insert_
or_ touch - Consumes the file
fromand publishes it to the raw cache fileto, a file directly under the raw cache directly, only if that file does not already exist. - insert_
or_ update - Consumes the file
fromand publishes it to the raw cache fileto, a file directly under the raw cache directory. - prune
- Attempts to prune the contents of
cache_dirdown to at mostcapacityfiles, with a second chance policy. - touch
- Sets the access bit to true for the file at
path: the next time that file is up for eviction, it will get a second chance. Returns true if the file was found, false otherwise.