mirror of
git://git.proxmox.com/git/pxar.git
synced 2025-01-10 09:17:40 +03:00
add missing file
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
9d8af6f286
commit
be35e740a7
16
src/accessor/cache.rs
Normal file
16
src/accessor/cache.rs
Normal file
@ -0,0 +1,16 @@
|
||||
//! Cache helper for random access pxar accesses.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
/// A simple asynchronous caching trait to help speed up random access for pxar archives.
|
||||
pub trait Cache<K, V: ?Sized> {
|
||||
/// Fetch a value from this cache store.
|
||||
fn fetch(&self, key: K) -> Option<Arc<V>>;
|
||||
|
||||
/// Update the cache with a value.
|
||||
///
|
||||
/// It is up to the implementation to choose whether or not to store the value. Note that since
|
||||
/// all values are `Arc`s, the values will remain alive as long as they're in use even if
|
||||
/// they're not cached.
|
||||
fn insert(&self, key: K, value: Arc<V>);
|
||||
}
|
Loading…
Reference in New Issue
Block a user