Example #1
0
 public bool EvictData(CacheSpace space, ICacheSpaceConsumer consumer, long requiredSpace)
 {
     if (!consumer.IsEvictionEnabled)
     {
         return(false);
     }
     consumer.EvictData(requiredSpace);
     return(true);
 }
Example #2
0
        public DocumentCache(BaseCollection parent, NodeContext nodeContext)
        {
            _parent     = parent;
            _cacheSpace = parent.DbContext.CacheSpace;

            _cacheSpace.AddConsumer(this);
            _storageManager        = parent.DbContext.StorageManager;
            _dirtyDocuments        = new Dictionary <long, PersistenceOperation>();
            _unpersistedOperations = _parent.DbContext.UnpersistedOperations;
            _nodeContext           = nodeContext;
            _statsCollector        = StatsManager.Instance.GetStatsCollector(_parent.DbContext.StatsIdentity);
        }
Example #3
0
 public bool CanConsumeSpace(CacheSpace space, ICacheSpaceConsumer consumer, long requiredSpace)
 {
     if (space.AvaialbeSpace < requiredSpace)
     {
         return(EvictData(space, consumer, requiredSpace));
     }
     return(true);
     // if user thread is supposed to do eviction then there is no need for threshold i guess.
     //if (space.AvaialbeSpace < space.Threshold)
     //{
     //    //TODO: start eviction currently it is need base to user thread will do the eviction.
     //}
 }