Module kismet_cache::raw_cache

source ·
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

  • Consumes the file from and publishes it to the raw cache file to, a file directly under the raw cache directly, only if that file does not already exist.
  • Consumes the file from and publishes it to the raw cache file to, a file directly under the raw cache directory.
  • Attempts to prune the contents of cache_dir down to at most capacity files, with a second chance policy.
  • 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.