pub trait CacheKeyLock {
// Required methods
fn lock(&self, key: &CacheKey) -> Locked;
fn release(&self, key: &CacheKey, permit: WritePermit, reason: LockStatus);
}Required Methods§
Sourcefn lock(&self, key: &CacheKey) -> Locked
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.
Sourcefn release(&self, key: &CacheKey, permit: WritePermit, reason: LockStatus)
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.