Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="realCache"></param>
        /// <param name="backgroundScheduler"></param>
        /// <param name="pollTimer"></param>
        public CacheManager(Cache realCache, BackgroundScheduler backgroundScheduler, ExpirationPollTimer pollTimer)
        {
            if (pollTimer == null) throw new ArgumentNullException("pollTimer");

            this.realCache = realCache;
            this.pollTimer = pollTimer;
            this.backgroundScheduler = backgroundScheduler;

            pollTimer.StartPolling(backgroundScheduler.ExpirationTimeoutExpired);
        }
Beispiel #2
0
        /// <summary>
        /// Not intended for public use. Only public due to requirements of IDisposable. If you call this method, your
        /// cache will be unusable.
        /// </summary>
        public void Dispose()
        {
            GC.SuppressFinalize(this);

            if (pollTimer != null)
            {
                pollTimer.StopPolling();
                pollTimer = null;
            }
            if (realCache != null)
            {
                realCache.Dispose();
                realCache = null;
            }
        }