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);
        }
Beispiel #2
0
 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);
 }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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);
        }