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);
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
 public void Dispose()
 {
     try
     {
         if (!_added)
         {
             _added = true;
             _notifyCacheEntryDisposed(this);
         }
     }
     finally
     {
         CacheEntryHelper.LeaveScope();
         PropageOptions(CacheEntryHelper.Current);
     }
 }
Ejemplo n.º 5
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);
        }