Example #1
0
        public static List <FieldInfo> GetFieldInfoList(int siteId, int channelId, int contentId)
        {
            var cacheKey = CacheUtils.GetCacheKey(nameof(FieldManager), nameof(GetFieldInfoList), siteId.ToString(), channelId.ToString(), contentId.ToString());
            var list     = CacheUtils.Get <List <FieldInfo> >(cacheKey);

            if (list != null)
            {
                return(list);
            }

            list = Main.FieldDao.GetFieldInfoList(siteId, channelId, contentId, true);
            CacheUtils.Insert(cacheKey, list);
            return(list);
        }
        public static string GetListHtml()
        {
            var directoryPath = GetTemplatesDirectoryPath();
            var htmlPath      = PollUtils.PathCombine(directoryPath, "list.html");
            var html          = CacheUtils.Get <string>(htmlPath);

            if (html != null)
            {
                return(html);
            }

            html = PollUtils.ReadText(htmlPath);

            CacheUtils.Insert(htmlPath, html, 24);
            return(html);
        }
Example #3
0
            public static List <KeyValuePair <string, ItemInfo> > GetAllItemInfoList(int pollId)
            {
                var cacheKey = GetCacheKey(pollId);
                var retVal   = CacheUtils.Get <List <KeyValuePair <string, ItemInfo> > >(cacheKey);

                if (retVal != null)
                {
                    return(retVal);
                }

                lock (LockObject)
                {
                    retVal = CacheUtils.Get <List <KeyValuePair <string, ItemInfo> > >(cacheKey);
                    if (retVal == null)
                    {
                        retVal = Repository.GetAllItemInfoList(pollId);

                        CacheUtils.Insert(cacheKey, retVal, 12);
                    }
                }

                return(retVal);
            }
Example #4
0
            public static IList <PollInfo> GetCachePollInfoList(int siteId)
            {
                var cacheKey = GetCacheKey(siteId);
                var retVal   = CacheUtils.Get <IList <PollInfo> >(cacheKey);

                if (retVal != null)
                {
                    return(retVal);
                }

                lock (LockObject)
                {
                    retVal = CacheUtils.Get <IList <PollInfo> >(cacheKey);
                    if (retVal == null)
                    {
                        retVal = Repository.GetPollInfoList(siteId);

                        CacheUtils.Insert(cacheKey, retVal, 12);
                    }
                }

                return(retVal);
            }