Exemple #1
0
 public void EvictData(long size)
 {
     //TODO: evict items so that size amount of space is freed
     if (!_evictionPolicy.Execute(this, size))
     {
         //TODO: if eviction does not free space.
         int a = 1;
     }
     //throw new NotImplementedException();
 }
Exemple #2
0
 /// <summary>
 /// Faz a liberação.
 /// </summary>
 /// <param name="cache"></param>
 private void DoEvict(CacheBase cache)
 {
     if (_evictionPolicy != null)
     {
         _evictionPolicy.Execute(cache, base._context, this.Size);
         if (_allowExplicitGCCollection)
         {
             GC.Collect();
         }
     }
 }
Exemple #3
0
 public void Execute(CacheBase cache, CacheRuntimeContext context, long count)
 {
     Sync.AcquireWriterLock(Timeout.Infinite);
     try
     {
         _evctPolicy.Execute(cache, context, count);
     }
     finally
     {
         Sync.ReleaseWriterLock();
     }
 }
Exemple #4
0
 /// <summary>
 /// Evicts the items from the cache.
 /// </summary>
 private void DoEvict(CacheBase cache)
 {
     try
     {
         if (_evictionPolicy != null)
         {
             _evictionPolicy.Execute(cache, _context, Size);
         }
     }
     finally
     {
     }
 }
Exemple #5
0
        /// <summary>
        /// Evicts the items from the cache.
        /// </summary>
        private void DoEvict(CacheBase cache)
        {
            try
            {
                if (_evictionPolicy != null)
                {
                    var  sizeToEvict = (long)Math.Ceiling(Size * _evictionPolicy.EvictRatio);
                    long evictedSize = _evictionPolicy.Execute(cache, _context, Size);

                    if (sizeToEvict > evictedSize)
                    {
                        _context.MessageManager.Evict(sizeToEvict - evictedSize);
                    }
                }
            }
            finally
            {
            }
        }