Struct kdevice::cache::CacheEntry [−][src]
pub struct CacheEntry<'a, T: Cache> { /* fields omitted */ }
Expand description
Representing a client of a cache entry.
There may be several CacheEntry
that refer to the same cache entry (i.e. same key) at a time.
Therefore, Cache
maintains reference counter for each in-memory cache entry. If the
reference couter is not zero, it cannot be replace by another cache entyr. Once the the counter
decreases to zero, it will be moved to the back of LRU and can be flushed to disk when replaced
by another cache entry.
Implementations
impl<'a, T: Cache> CacheEntry<'a, T>
[src]
impl<'a, T: Cache> CacheEntry<'a, T>
[src]pub async fn lock(&'a self) -> Result<CacheGuard<'a, T>>
[src]
pub async fn lock(&'a self) -> Result<CacheGuard<'a, T>>
[src]Lock and read the cache entry.
pub fn leak(self) -> CacheNodePtr<T::Key, T::Value>
[src]
pub fn leak(self) -> CacheNodePtr<T::Key, T::Value>
[src]Get pointer to this cache entry.
pub fn key(&self) -> T::Key
[src]
pub fn key(&self) -> T::Key
[src]Get the key of this cache entry.
Safe since the key is immutable since referenced.
Trait Implementations
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for CacheEntry<'a, T>
impl<'a, T> Send for CacheEntry<'a, T> where
T: Sync,
<T as Cache>::Key: Send,
<T as Cache>::Value: Send,
T: Sync,
<T as Cache>::Key: Send,
<T as Cache>::Value: Send,
impl<'a, T> Sync for CacheEntry<'a, T> where
T: Sync,
<T as Cache>::Key: Sync,
<T as Cache>::Value: Sync,
T: Sync,
<T as Cache>::Key: Sync,
<T as Cache>::Value: Sync,