public bool EvictData(CacheSpace space, ICacheSpaceConsumer consumer, long requiredSpace) { if (!consumer.IsEvictionEnabled) { return(false); } consumer.EvictData(requiredSpace); return(true); }
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); }
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. //} }