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.

Return the current size of all the files in the cache.

Return the count of entries in the cache.

Return the maximum size of the cache.

Return the path in which the cache is stored.

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.

Remove the given key from the cache.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.