Struct ritecache::DiskCache [−][src]
pub struct DiskCache<C, S: BuildHasher + Clone = DefaultHashBuilder> where
C: Cache<OsString, u64, S, FileSize>, { /* fields omitted */ }
Expand description
An basic disk cache of files on disk.
Implementations
Create an LruDiskCache
that stores files in path
, limited to size
bytes.
Existing files in path
will be stored with their last-modified time from the filesystem
used as the order for the recency of their use. Any files that are individually larger
than size
bytes will be removed.
The cache is not observant of changes to files under path
from external sources, it
expects to have sole maintence of the contents.
Create an LruDiskCache
that stores files in path
, limited to size
bytes.
Existing files in path
will be stored with their last-modified time from the filesystem
used as the order for the recency of their use. Any files that are individually larger
than size
bytes will be removed.
The cache is not observant of changes to files under path
from external sources, it
expects to have sole maintence of the contents.
Returns true
if the disk cache can store a file of size
bytes.
Add a file by calling with
with the open File
corresponding to the cache at path key
.
Add a file with bytes
as its contents to the cache at path key
.
Add an existing file at path
to the cache at path key
.
Return true
if a file with path key
is in the cache.
Get an opened File
for key
, if one exists and can be opened. Updates the LRU state
of the file if present. Avoid using this method if at all possible, prefer .get
.
Get an opened readable and seekable handle to the file at key
, if one exists and can
be opened. Updates the LRU state of the file if present.