-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,726 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,37 @@ | ||
mod cache_dir; | ||
mod plain; | ||
pub mod raw_cache; | ||
mod readonly; | ||
pub mod second_chance; | ||
mod sharded; | ||
mod stack; | ||
mod trigger; | ||
|
||
pub use plain::PlainCache; | ||
pub use readonly::ReadOnlyCache; | ||
pub use readonly::ReadOnlyCacheBuilder; | ||
pub use sharded::ShardedCache; | ||
pub use stack::Cache; | ||
pub use stack::CacheBuilder; | ||
|
||
/// Sharded cache keys consist of a filename and two hash values. The | ||
/// two hashes should be computed by distinct functions of the key's | ||
/// name, and each hash function must be identical for all processes | ||
/// that access the same sharded cache directory. | ||
#[derive(Clone, Copy, Debug)] | ||
pub struct Key<'a> { | ||
pub name: &'a str, | ||
pub hash: u64, | ||
pub secondary_hash: u64, | ||
} | ||
|
||
impl<'a> Key<'a> { | ||
/// Returns a new `Key` for this `name`, `hash`, and `secondary_hash`. | ||
pub fn new(name: &str, hash: u64, secondary_hash: u64) -> Key { | ||
Key { | ||
name, | ||
hash, | ||
secondary_hash, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.