Ejemplo n.º 1
0
        public InMemoryCache(string region, TimeSpan? timeToLive, TimeSpan? timeToIdle)
        {
            if (string.IsNullOrEmpty(region))
            {
                throw new ArgumentNullException(nameof(region));
            }

            if (timeToLive.HasValue && timeToLive.Value.TotalMilliseconds <= 0)
            {
                throw new ArgumentException("TTL duration must be greater than zero.", nameof(timeToLive));
            }

            if (timeToIdle.HasValue && timeToIdle.Value.TotalMilliseconds <= 0)
            {
                throw new ArgumentException("TTI duration must be greater than zero.", nameof(timeToIdle));
            }

            this.cacheManager = new InMemoryCacheManager();
            this.region = region;
            this.timeToLive = timeToLive;
            this.timeToIdle = timeToIdle;

            this.accessCount = 0;
            this.hitCount = 0;
            this.missCount = 0;
        }
Ejemplo n.º 2
0
        public InMemoryCache(string region, TimeSpan?timeToLive, TimeSpan?timeToIdle)
        {
            if (string.IsNullOrEmpty(region))
            {
                throw new ArgumentNullException(nameof(region));
            }

            if (timeToLive.HasValue && timeToLive.Value.TotalMilliseconds <= 0)
            {
                throw new ArgumentException("TTL duration must be greater than zero.", nameof(timeToLive));
            }

            if (timeToIdle.HasValue && timeToIdle.Value.TotalMilliseconds <= 0)
            {
                throw new ArgumentException("TTI duration must be greater than zero.", nameof(timeToIdle));
            }

            this.cacheManager = new InMemoryCacheManager();
            this.region       = region;
            this.timeToLive   = timeToLive;
            this.timeToIdle   = timeToIdle;

            this.accessCount = 0;
            this.hitCount    = 0;
            this.missCount   = 0;
        }
Ejemplo n.º 3
0
 public void Clear()
 {
     this.cacheManager.Dispose();
     this.cacheManager = new InMemoryCacheManager();
 }
Ejemplo n.º 4
0
 public void Clear()
 {
     this.cacheManager.Dispose();
     this.cacheManager = new InMemoryCacheManager();
 }