Esempio n. 1
0
        public List <Project> GetAllProjects(string siteName = null)
        {
            var result = new List <Project>();

            if (siteName == null)
            {
                siteName = SiteContext.CurrentSiteName;
            }
            using (var cs = new CachedSection <List <Project> >(ref result, CacheHelper.CacheMinutes(siteName), true, _projectCacheKey))
            {
                if (cs.LoadData)
                {
                    result = ProjectProvider.GetProjects().OnSite(siteName).ToList();

                    var cacheDependencies = new List <string>
                    {
                        $"nodes|{siteName}|{Project.CLASS_NAME}|all"
                    };

                    cs.Data            = result;
                    cs.CacheDependency = CacheHelper.GetCacheDependency(cacheDependencies);
                }
            }

            return(result);
        }