]>
git.proxmox.com Git - pxar.git/blob - src/accessor/cache.rs
1 //! Cache helper for random access pxar accesses.
5 /// A simple asynchronous caching trait to help speed up random access for pxar archives.
6 pub trait Cache
<K
, V
: ?Sized
> {
7 /// Fetch a value from this cache store.
8 fn fetch(&self, key
: K
) -> Option
<Arc
<V
>>;
10 /// Update the cache with a value.
12 /// It is up to the implementation to choose whether or not to store the value. Note that since
13 /// all values are `Arc`s, the values will remain alive as long as they're in use even if
14 /// they're not cached.
15 fn insert(&self, key
: K
, value
: Arc
<V
>);