Exemplo n.º 1
0
 internal override void TouchAfterUnlocked(CacheRecord record, bool recordIsNew)
 {
     if (recordIsNew)
     {
         this.NotifyObservers(record.GetFuture(), true);
     }
 }
Exemplo n.º 2
0
        private void Clean(bool purge)
        {
            int  num  = 0;
            long num2 = this.memoryUsed;
            List <CacheRecord> list = new List <CacheRecord>();

            Monitor.Enter(this);
            try
            {
                while ((purge && this.lruQueue.Count > 0) || (this.memoryUsed > SizeSensitiveCache.paramCacheMaxSize && ((SizeSensitiveCache.oneEntryAtATime && this.lruQueue.Count > 0) || (!SizeSensitiveCache.oneEntryAtATime && this.lruQueue.Count > 1))))
                {
                    CacheRecord value = this.lruQueue.First.Value;
                    num++;
                    list.Add(value);
                    this.Remove(value, CacheBase.RemoveExpectation.Present);
                    this.spillCount++;
                }
            }
            finally
            {
                Monitor.Exit(this);
            }
            foreach (CacheRecord current in list)
            {
                this.NotifyObservers(current.GetFuture(), false);
            }
            D.Sayf(10, "SizeSensitive Cleaner: removed {0} objects; from {1} to {2} MB", new object[]
            {
                num,
                num2 >> 20,
                this.memoryUsed >> 20
            });
        }
Exemplo n.º 3
0
		internal override void TouchAfterUnlocked(CacheRecord record, bool recordIsNew)
		{
			if (recordIsNew)
			{
				this.NotifyObservers(record.GetFuture(), true);
			}
		}
Exemplo n.º 4
0
 internal override void Touch(CacheRecord record, bool recordIsNew)
 {
     if (recordIsNew)
     {
         this.clockQueue.AddLast(record);
     }
     ((ClockCacheRecord)record).touched = true;
 }
Exemplo n.º 5
0
		internal override void Touch(CacheRecord record, bool recordIsNew)
		{
			if (recordIsNew)
			{
				this.clockQueue.AddLast(record);
			}
			((ClockCacheRecord)record).touched = true;
		}
Exemplo n.º 6
0
 internal override void Touch(CacheRecord record, bool recordIsNew)
 {
     if (!recordIsNew)
     {
         this.lruQueue.Remove(record);
     }
     this.UpdateSizeForRecord((SizedCacheRecord)record);
     this.lruQueue.AddLast(record);
 }
Exemplo n.º 7
0
		internal override void Touch(CacheRecord record, bool recordIsNew)
		{
			if (!recordIsNew)
			{
				this.lruQueue.Remove(record);
			}
			this.UpdateSizeForRecord((SizedCacheRecord)record);
			this.lruQueue.AddLast(record);
		}
Exemplo n.º 8
0
		internal virtual void Remove(CacheRecord record, CacheBase.RemoveExpectation removeExpectation)
		{
			Monitor.Enter(this);
			try
			{
				bool flag = this.cache.Remove(record.GetFuture());
				D.Assert(removeExpectation == CacheBase.RemoveExpectation.Unknown || removeExpectation == CacheBase.RemoveExpectation.Present == flag, "Remove didn't meet expectations. That could suggest a mutating hash.");
				this.resourceCounter.crement(-1);
				record.DropReference();
			}
			finally
			{
				Monitor.Exit(this);
			}
		}
Exemplo n.º 9
0
 internal virtual void Remove(CacheRecord record, CacheBase.RemoveExpectation removeExpectation)
 {
     Monitor.Enter(this);
     try
     {
         bool flag = this.cache.Remove(record.GetFuture());
         D.Assert(removeExpectation == CacheBase.RemoveExpectation.Unknown || removeExpectation == CacheBase.RemoveExpectation.Present == flag, "Remove didn't meet expectations. That could suggest a mutating hash.");
         this.resourceCounter.crement(-1);
         record.DropReference();
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Exemplo n.º 10
0
 internal void Evict(IFuture future)
 {
     Monitor.Enter(this);
     try
     {
         bool flag = cache.ContainsKey(future);
         if (flag)
         {
             CacheRecord record = cache[future];
             Remove(record, RemoveExpectation.Unknown);
         }
     }
     finally
     {
         Monitor.Exit(this);
     }
 }
Exemplo n.º 11
0
		internal override void Remove(CacheRecord record, CacheBase.RemoveExpectation removeExpectation)
		{
			base.Remove(record, removeExpectation);
		}
Exemplo n.º 12
0
 internal abstract void Touch(CacheRecord record, bool recordIsNew);
Exemplo n.º 13
0
 internal override void Remove(CacheRecord record, RemoveExpectation removeExpectation)
 {
     base.Remove(record, removeExpectation);
 }
Exemplo n.º 14
0
 internal override void Remove(CacheRecord record, CacheBase.RemoveExpectation removeExpectation)
 {
     this.memoryUsed -= ((SizedCacheRecord)record).memoryCharge;
     this.lruQueue.Remove(record);
     base.Remove(record, removeExpectation);
 }
Exemplo n.º 15
0
 internal virtual void TouchAfterUnlocked(CacheRecord record, bool recordIsNew)
 {
 }
Exemplo n.º 16
0
		internal abstract void Touch(CacheRecord record, bool recordIsNew);
Exemplo n.º 17
0
		internal override void Remove(CacheRecord record, CacheBase.RemoveExpectation removeExpectation)
		{
			this.memoryUsed -= ((SizedCacheRecord)record).memoryCharge;
			this.lruQueue.Remove(record);
			base.Remove(record, removeExpectation);
		}
Exemplo n.º 18
0
		internal virtual void TouchAfterUnlocked(CacheRecord record, bool recordIsNew)
		{
		}