Esempio n. 1
0
        public void Clear()
        {
            CachePermission.InvalidateCache.AssertAuthorized();

            CacheLogic.ForceReset();
            GlobalLazy.ResetAll();
            GC.Collect(2);
        }
Esempio n. 2
0
        public ActionResult Clean()
        {
            CachePermission.InvalidateCache.AssertAuthorized();

            CacheLogic.ForceReset();
            GlobalLazy.ResetAll();
            return(null);
        }
Esempio n. 3
0
        public UrlsRepository(string virtualPathPrefix)
        {
            if (string.IsNullOrEmpty(virtualPathPrefix))
            {
                throw new ArgumentNullException("virtualPath");
            }

            this.VirtualPathPrefix = virtualPathPrefix.ToLower();

            FileLazy = GlobalLazy.WithoutInvalidations(() => new StaticContentResult(CreateFile(), fileName));
        }
Esempio n. 4
0
        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
            });
        }
Esempio n. 5
0
    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
        });
    }
Esempio n. 6
0
        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()));
            }
        }