private void SetupCache(CacheSettingsBuilder builder) { if (!CacheEnabled) { return; } builder.UseSecondLevelCache() .UseQueryCache() .QueryCacheFactory <StandardQueryCacheFactory>(); MrCMSConfigSection mrCMSSection = WebConfigurationManager.GetSection("mrcms") as MrCMSConfigSection; if (mrCMSSection != null) { builder.ProviderClass(mrCMSSection.CacheProvider.AssemblyQualifiedName); if (mrCMSSection.MinimizePuts) { builder.UseMinimalPuts(); } } else { builder.ProviderClass <SysCacheProvider>(); } }
/// <summary> /// Initializes a new instance of the <see cref="AzureCacheAdapter"/> class. /// </summary> /// <param name="name">The name of the region</param> /// <param name="serializationProvider"></param> public AzureCacheAdapter(string name) { _serializationProvider = MrCMSApplication.Get <ISerializationProvider>(); //validate the params if (string.IsNullOrEmpty(name)) { Log.Info("No region name specified for cache region. Using default name of 'nhibernate'"); name = "nhibernate"; } MrCMSConfigSection mrCMSSection = WebConfigurationManager.GetSection("mrcms") as MrCMSConfigSection; _webCache = AzureCacheFactory.Instance.GetCache(mrCMSSection == null ? "default" : mrCMSSection.CacheName); _name = StripNonAlphaNumeric(name); //configure the cache region based on the configured settings and any relevant nhibernate settings }
public void ClearCache() { MrCMSConfigSection mrCMSSection = WebConfigurationManager.GetSection("mrcms") as MrCMSConfigSection; if (mrCMSSection != null) { System.Type cacheProvider = mrCMSSection.CacheProvider; if (cacheProvider == typeof(AzureCacheProvider)) { AzureCacheFactory.Instance.GetCache(mrCMSSection.CacheName).Clear(); return; } } _cacheManager.Clear(); foreach (IClearCache cache in _manualCacheClears) { cache.ClearCache(); } }