public bool TrySet(string name, RetainableDeepZoomGenerator dz) { var cacheEntryOption = new MemoryCacheEntryOptions { SlidingExpiration = TimeSpan.FromMinutes(3) }; cacheEntryOption.RegisterPostEvictionCallback(ItemEvicted); RetainableDeepZoomGenerator cachedDz = _cache.Set(name, dz, cacheEntryOption); return(ReferenceEquals(cachedDz, dz)); }
public bool TryGet(string name, out RetainableDeepZoomGenerator dz) { return(_cache.TryGetValue(name, out dz)); }