internal CacheEntry( object key, Action <CacheEntry> notifyCacheEntryDisposed, Action <CacheEntry> notifyCacheOfExpiration) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (notifyCacheEntryDisposed == null) { throw new ArgumentNullException(nameof(notifyCacheEntryDisposed)); } if (notifyCacheOfExpiration == null) { throw new ArgumentNullException(nameof(notifyCacheOfExpiration)); } Key = key; _notifyCacheEntryDisposed = notifyCacheEntryDisposed; _notifyCacheOfExpiration = notifyCacheOfExpiration; _scope = CacheEntryHelper.EnterScope(this); }
internal CacheEntry( object key, Action <CacheEntry> notifyCacheEntryCommit, Action <CacheEntry> notifyCacheOfExpiration, ILogger logger) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (notifyCacheEntryCommit == null) { throw new ArgumentNullException(nameof(notifyCacheEntryCommit)); } if (notifyCacheOfExpiration == null) { throw new ArgumentNullException(nameof(notifyCacheOfExpiration)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } Key = key; _notifyCacheEntryCommit = notifyCacheEntryCommit; _notifyCacheOfExpiration = notifyCacheOfExpiration; _scope = CacheEntryHelper.EnterScope(this); _logger = logger; }
internal CacheEntry(object key, MemoryCache memoryCache) { Key = key ?? throw new ArgumentNullException(nameof(key)); _cache = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache)); _previous = CacheEntryHelper.EnterScope(this); _state = new CacheEntryState(CacheItemPriority.Normal); }
public void Dispose() { try { if (!_added) { _added = true; _notifyCacheEntryDisposed(this); } } finally { CacheEntryHelper.LeaveScope(); PropageOptions(CacheEntryHelper.Current); } }
private int _state; // actually a [Flag] enum called "State" internal CacheEntry(object key, MemoryCache memoryCache) { Key = key ?? throw new ArgumentNullException(nameof(key)); _cache = memoryCache ?? throw new ArgumentNullException(nameof(memoryCache)); _previous = CacheEntryHelper.EnterScope(this); }