Trait CacheKeyLock

Source
pub trait CacheKeyLock {
    // Required methods
    fn lock(&self, key: &CacheKey) -> Locked;
    fn release(&self, key: &CacheKey, permit: WritePermit, reason: LockStatus);
}

Required Methods§

Source

fn lock(&self, key: &CacheKey) -> Locked

Try to lock a cache fetch

Users should call after a cache miss before fetching the asset. The returned Locked will tell the caller either to fetch or wait.

Source

fn release(&self, key: &CacheKey, permit: WritePermit, reason: LockStatus)

Release a lock for the given key

When the write lock is dropped without being released, the read lock holders will consider it to be failed so that they will compete for the write lock again.

Implementors§