Example #1
0
		private static CacheStore GetCacheStore( UniqingScope uniqingScope, string scopeDelimiter, CacheContentType contentType )
		{
			// make sure we always get the global cache if scope is global
			if( scope == UniqingScope.Application )
			{
				scopeDelimiter = null;
			}
			else if( scopeDelimiter == null )
			{
				scopeDelimiter = GetScopeDelimiter();
			}
			// determine which cache to use - first get array of cache stores for the specified scope
			string scopeKey = String.Format( "{0}|{1}", uniqingScope, scopeDelimiter );
			CacheStore[] cacheStores = stores[ scopeKey ] as CacheStore[];
			if( cacheStores == null )
			{
				cacheStores = new CacheStore[Enum.GetNames( typeof(CacheContentType) ).Length];
				stores[ scopeKey ] = cacheStores;
			}
			// get specific cache store by content type
			CacheStore cacheStore = cacheStores[ (int) contentType ];
			if( cacheStore == null )
			{
				cacheStore = new CacheStore();
				cacheStores[ (int) contentType ] = cacheStore;
			}
			return cacheStore;
		}
Example #2
0
		private static CacheStore[] GetCacheStores( UniqingScope uniqingScope, string scopeDelimiter )
		{
			// make sure we always get the global cache if scope is global
			if( scope == UniqingScope.Application )
			{
				scopeDelimiter = null;
			}
			else if( scopeDelimiter == null )
			{
				scopeDelimiter = GetScopeDelimiter();
			}
			// determine which cache to use
			string scopeKey = String.Format( "{0}|{1}", uniqingScope, scopeDelimiter );
			CacheStore[] cacheStores = stores[ scopeKey ] as CacheStore[];
			if( cacheStores == null )
			{
				cacheStores = new CacheStore[Enum.GetNames( typeof(CacheContentType) ).Length];
				stores[ scopeKey ] = cacheStores;
			}
			return cacheStores;
		}