internal static void LockKey(string key) { try { Monitor.Enter(MlcSlcCache.GetKeyLocker(key)); } catch (Exception exception1) { Exception exception = exception1; Logger.ErrorFormat(LogMessages.SqlDacs.Caching.KeyLockingError, exception, new object[] { key }); } }
internal static void ClearCache(string tokenValue) { try { MlcSlcCache.RemoveItemsFromCache(new string[] { MlcSlcCache.BaseKey }); Logger.InfoFormat(LogMessages.SqlDacs.Caching.CacheClearedSuccessfully, new object[] { tokenValue }); } catch (Exception exception) { Logger.ErrorFormat(LogMessages.SqlDacs.Caching.CacheClearingError, new object[] { tokenValue }); } }
internal static T GetItemFromCache <T>(string key) where T : class { T t; try { t = (T)HttpRuntime.get_Cache().Get(key); if (t != null) { t = MlcSlcCache.DeepClone <T>(t); } } catch (Exception exception1) { Exception exception = exception1; Logger.ErrorFormat(LogMessages.SqlDacs.Caching.ExtractingItemError, exception, new object[] { key }); t = default(T); } return(t); }
internal static void InsertItemInCache <T>(string key, T item, AggregateCacheDependency dependency, TimeSpan slidingExpiration, CacheItemPriority priority) { try { T t = item; if (item != null) { t = MlcSlcCache.DeepClone <T>(item); } if (!EqualityComparer <T> .Default.Equals(t, default(T))) { HttpRuntime.get_Cache().Insert(key, t, dependency, Cache.NoAbsoluteExpiration, slidingExpiration, priority, null); } } catch (Exception exception1) { Exception exception = exception1; Logger.ErrorFormat(LogMessages.SqlDacs.Caching.InsertItemError, exception, new object[] { key }); throw; } }