Example #1
0
        // NOTE: this method _MUST_ be called with the write lock held
        void AddToCache(string key, MemoryCacheEntry entry, bool update = false)
        {
            if (update)
            {
                cache [key] = entry;
            }
            else
            {
                cache.Add(key, entry);
            }
            lru.Update(entry);
            entry.Added();
            if (!update)
            {
                perfCounters.Increment(MemoryCachePerformanceCounters.CACHE_ENTRIES);
            }

            if (entry.IsExpirable)
            {
                UpdateExpirable(entry);
            }
        }
Example #2
0
		// NOTE: this method _MUST_ be called with the write lock held
		void AddToCache (string key, MemoryCacheEntry entry, bool update = false)
		{
			if (update)
				cache [key] = entry;
			else
				cache.Add (key, entry);
			lru.Update (entry);
			entry.Added ();
			if (!update)
				perfCounters.Increment (MemoryCachePerformanceCounters.CACHE_ENTRIES);
			
			if (entry.IsExpirable)
				UpdateExpirable (entry);
		}