// 15 phĂșt public static T GetOrSet <T>(string key, CacheRegion region, System.Func <T> valueFactory, TimeoutMinutes timeoutMinutes = TimeoutMinutes.m15) { try { if (!CacheManager.Exists(key, region.ToString())) { var item = new CacheItem <object>(key, region.ToString(), valueFactory(), ExpirationMode.Absolute, TimeSpan.FromMinutes((int)timeoutMinutes)); CacheManager.Add(item); } } catch (Exception ex) { return(default(T)); } return(CacheManager.Get <T>(key, region.ToString())); }
public static bool Remove( string key, CacheRegion region ) { return(CacheManager.Remove(key, region.ToString())); }
internal static void Remove(this ICacheService cacheService, CacheRegion region) { if (cacheService == null) { throw new ArgumentNullException(nameof(cacheService)); } cacheService.RemoveRegion(region.ToString()); }
public static void Remove(CacheRegion region) { CacheManager.ClearRegion(region.ToString()); }
/// <summary> /// Returns a string that represents the current <see cref="TridionDependency" />. /// </summary> /// <returns> /// A string that represents the current <see cref="TridionDependency" />. /// </returns> public override String ToString() { return(String.Format("{0}-{1}", mCacheRegion.ToString(), mKey)); }