Struct kismet_cache::sharded::Cache[][src]

pub struct Cache { /* fields omitted */ }
Expand description

A sharded cache is a hash-sharded directory of cache subdirectories. Each subdirectory is managed as an independent second chance cache directory.

Implementations

Returns a new cache for approximately total_capacity files, stores in num_shards subdirectories of base_dir.

Returns a read-only file for key in the shard cache directory if it exists, or None if there is no such file. Fails with ErrorKind::InvalidInput if key.name is invalid (empty, or starts with a dot or a forward or back slash).

Implicitly “touches” the cached file if it exists.

Returns a temporary directory suitable for temporary files that will be published to the shard cache directory.

When this temporary file will be published at a known Key, populate key for improved behaviour.

Inserts or overwrites the file at value as key in the sharded cache directory. There may be two entries for the same key with concurrent set or put calls. Fails with ErrorKind::InvalidInput if key.name is invalid (empty, or starts with a dot or a forward or back slash).

Always consumes the file at value on success; may consume it on error.

Inserts the file at value as key in the cache directory if there is no such cached entry already, or touches the cached file if it already exists. There may be two entries for the same key with concurrent set or put calls. Fails with ErrorKind::InvalidInput if key.name is invalid (empty, or starts with a dot or a forward or back slash).

Always consumes the file at value on success; may consume it on error.

Marks the cached file key as newly used, if it exists. Fails with ErrorKind::InvalidInput if key.name is invalid (empty, or starts with a dot or a forward or back slash).

Returns whether a file for key exists in the cache.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.