/// <summary> /// Gets a generic cache that is OUTSIDE of the system/tenant caches /// and cannot be flushed /// </summary> /// <param name="cacheName"></param> /// <returns></returns> public static ObjectCache GetGenericCache( string cacheName ) { ObjectCache cache; if ( GenericCaches.TryGetValue( cacheName, out cache ) ) { return cache; } // otherwise, create it and add it cache = new ObjectCache(); GenericCaches.Add( cacheName, cache ); return cache; }
/// <summary> /// Gets a cache from the pool by name - creates it if it doesn't exist /// </summary> /// <param name="cacheName"></param> /// <returns></returns> public ObjectCache GetCache( string cacheName ) { ObjectCache cm; lock ( _caches ) { if ( Caches.TryGetValue( cacheName, out cm ) ) return cm; // otherwise, we have to create it //CacheManger factory = new ObjectCacheFactory( ConfigurationSourceFactory.Create() ); //cm = factory.Create( DefaultCacheProfile ); // create a new cache cm = new ObjectCache(); Caches.Add( cacheName, cm ); //add the cache } return cm; // keep it moving }