public void Clear() { CachePermission.InvalidateCache.AssertAuthorized(); CacheLogic.ForceReset(); GlobalLazy.ResetAll(); GC.Collect(2); }
public ActionResult Clean() { CachePermission.InvalidateCache.AssertAuthorized(); CacheLogic.ForceReset(); GlobalLazy.ResetAll(); return(null); }
public UrlsRepository(string virtualPathPrefix) { if (string.IsNullOrEmpty(virtualPathPrefix)) { throw new ArgumentNullException("virtualPath"); } this.VirtualPathPrefix = virtualPathPrefix.ToLower(); FileLazy = GlobalLazy.WithoutInvalidations(() => new StaticContentResult(CreateFile(), fileName)); }
public CacheStateTS View() { CachePermission.ViewCache.AssertAuthorized(); var tables = CacheLogic.Statistics().Select(ctb => new CacheTableTS(ctb)).ToList(); var lazies = GlobalLazy.Statistics().Select(ctb => new ResetLazyStatsTS(ctb)).ToList(); return(new CacheStateTS { isEnabled = !CacheLogic.GloballyDisabled, tables = tables, lazies = lazies }); }
public CacheStateTS View() { CachePermission.ViewCache.AssertAuthorized(); var tables = CacheLogic.Statistics().Select(ctb => new CacheTableTS(ctb)).ToList(); var lazies = GlobalLazy.Statistics().Select(ctb => new ResetLazyStatsTS(ctb)).ToList(); return(new CacheStateTS { IsEnabled = !CacheLogic.GloballyDisabled, ServerBroadcast = CacheLogic.ServerBroadcast?.ToString(), SqlDependency = CacheLogic.WithSqlDependency, Tables = tables, Lazies = lazies }); }
private ResetLazy <HashSet <K> > GetAllKeysLazy <T, KVP, K>(Expression <Func <T, IEnumerable <KVP> > > collectionSelector, Expression <Func <KVP, K> > keySelector) where T : Entity { if (typeof(K).IsEnum) { return(new ResetLazy <HashSet <K> >(() => EnumExtensions.GetValues <K>().ToHashSet())); } if (typeof(K).IsLite()) { return(GlobalLazy.WithoutInvalidations(() => Database.RetrieveAllLite(typeof(K).CleanType()).Cast <K>().ToHashSet())); } if (collectionSelector.Body.Type.IsMList()) { var lambda = Expression.Lambda <Func <T, MList <KVP> > >(collectionSelector.Body, collectionSelector.Parameters); return(GlobalLazy.WithoutInvalidations(() => Database.MListQuery(lambda).Select(kvp => keySelector.Evaluate(kvp.Element)).Distinct().ToHashSet())); } else { return(GlobalLazy.WithoutInvalidations(() => Database.Query <T>().SelectMany(collectionSelector).Select(keySelector).Distinct().ToHashSet())); } }