Ejemplo n.º 1
0
        MemoryCacheContainer FindContainer(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            if (emulateOneCPU || numCPUs == 1)
            {
                if (containers [0] == null)
                {
                    containers [0] = new MemoryCacheContainer(this, 0, perfCounters);
                }

                return(containers [0]);
            }

            int containerIdx = Math.Abs(key.GetHashCode() % numCPUs);

            if (containers [containerIdx] == null)
            {
                containers [containerIdx] = new MemoryCacheContainer(this, containerIdx, perfCounters);
            }

            return(containers [containerIdx]);
        }
Ejemplo n.º 2
0
		public MemoryCacheLRU (MemoryCacheContainer owner, int trimLowerBound)
		{
			this.trimLowerBound = trimLowerBound;
			index = new Dictionary <int, LinkedListNode <MemoryCacheEntry>> ();
			lru = new LinkedList <MemoryCacheEntry> ();
			this.owner = owner;
		}
Ejemplo n.º 3
0
 public MemoryCacheLRU(MemoryCacheContainer owner, int trimLowerBound)
 {
     this.trimLowerBound = trimLowerBound;
     index      = new Dictionary <int, LinkedListNode <MemoryCacheEntry> > ();
     lru        = new LinkedList <MemoryCacheEntry> ();
     this.owner = owner;
 }