Beispiel #1
0
        private MemoryCacheRegion ObtainRegion(string name, bool create = false)
        {
            if (name == null)
            {
                return(defaultRegion);
            }

            MemoryCacheRegion region = null;

            if (!regions.TryGetValue(name, out region) && create)
            {
                regions[name] = region = new MemoryCacheRegion();
            }

            return(region);
        }
Beispiel #2
0
 public MemoryCache()
 {
     poolingTimer  = new Timer(PerformPooling, null, 1000, 10 * 1000);
     defaultRegion = new MemoryCacheRegion();
     regions       = new Dictionary <string, MemoryCacheRegion>();
 }