// Calling thread need to be first lock "_lock" private ICacheEntry GetInternal(string key) { var inUse = _inUse.TryGetValue(key, out DiskCacheEntry entry); if (inUse) { return(entry); } var found = _lruCache.TryGetValue(key, out entry); if (found) { // Move from _lruCache to _inUse _lruCache.Remove(key); _inUse.TryAdd(key, entry); return(entry); } else { return(new EmptyCacheEntry()); } }
public Task RemoveAsync(string key, CancellationToken ct) { _cache.Remove(key); return(Task.CompletedTask); }