Beispiel #1
0
        public static string GetValue(string tableName, int contentId, string type)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetValue), tableName,
                                                       contentId.ToString(), type);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    var tuple = DataProvider.ContentDao.GetValue(tableName, contentId, type);
                    if (tuple != null)
                    {
                        retval = tuple.Item2;
                        StlCacheManager.Set(cacheKey, retval);
                    }
                }
            }

            return(retval);
        }
Beispiel #2
0
        public static string GetStlSqlStringCheckedBySearch(string tableName, int startNum, int totalNum, string orderByString, string whereString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache),
                                                       nameof(GetStlSqlStringCheckedBySearch),
                                                       tableName, startNum.ToString(), totalNum.ToString(), orderByString, whereString);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlSqlStringCheckedBySearch(tableName, startNum, totalNum,
                                                                                    orderByString, whereString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #3
0
        public static string GetStlSqlStringChecked(string tableName, int siteId, int channelId, int startNum, int totalNum, string orderByString, string whereString, EScopeType scopeType, string groupChannel, string groupChannelNot)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlSqlStringChecked),
                                                       tableName, siteId.ToString(), channelId.ToString(), startNum.ToString(),
                                                       totalNum.ToString(), orderByString, whereString, EScopeTypeUtils.GetValue(scopeType), groupChannel,
                                                       groupChannelNot);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    var channelInfo   = ChannelManager.GetChannelInfo(siteId, channelId);
                    var channelIdList = ChannelManager.GetChannelIdList(channelInfo, scopeType, groupChannel, groupChannelNot, string.Empty);
                    retval = DataProvider.ContentDao.GetStlSqlStringChecked(channelIdList, tableName, siteId, channelId, startNum,
                                                                            totalNum, orderByString, whereString, scopeType, groupChannel, groupChannelNot);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #4
0
        public static string GetStlWhereStringBySearch(string group, string groupNot, bool isImageExists, bool isImage, bool isVideoExists, bool isVideo, bool isFileExists, bool isFile, bool isTopExists, bool isTop, bool isRecommendExists, bool isRecommend, bool isHotExists, bool isHot, bool isColorExists, bool isColor, string where)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlWhereStringBySearch), group, groupNot, isImageExists.ToString(), isImage.ToString(),
                                                       isVideoExists.ToString(), isVideo.ToString(), isFileExists.ToString(), isFile.ToString(),
                                                       isTopExists.ToString(), isTop.ToString(), isRecommendExists.ToString(), isRecommend.ToString(),
                                                       isHotExists.ToString(), isHot.ToString(), isColorExists.ToString(), isColor.ToString(), where);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlWhereStringBySearch(group, groupNot,
                                                                               isImageExists, isImage, isVideoExists, isVideo, isFileExists, isFile, isTopExists, isTop,
                                                                               isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor, where);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static string GetSelectSqlStringByQueryString(string connectionString, string queryString, int startNum,
                                                             int totalNum, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlSqlContentsCache),
                                                       nameof(GetSelectSqlStringByQueryString), connectionString, queryString, startNum.ToString(),
                                                       totalNum.ToString(), orderByString);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.DatabaseDao.GetSelectSqlStringByQueryString(connectionString,
                                                                                      queryString, startNum, totalNum, orderByString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #6
0
        public static string GetStlWhereString(int siteId, string group, string groupNot, string tags, bool isTopExists, bool isTop, string where)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlWhereString),
                                                       siteId.ToString(), group, groupNot, tags, isTopExists.ToString(), isTop.ToString(),
                                                       where);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlWhereString(siteId, group, groupNot, tags,
                                                                       isTopExists, isTop, where);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static string GetWhereString(int siteId, string groupContent, string groupContentNot, bool isImageExists, bool isImage, string where)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetWhereString),
                                                       siteId.ToString(), groupContent, groupContentNot, isImageExists.ToString(),
                                                       isImage.ToString(), where);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetWhereString(groupContent, groupContentNot,
                                                                    isImageExists, isImage, where);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #8
0
        public static List <TagInfo> GetTagInfoList(int siteId, int contentId, bool isOrderByCount, int totalNum)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlTagCache),
                                                       nameof(GetTagInfoList), siteId.ToString(), contentId.ToString(), isOrderByCount.ToString(), totalNum.ToString());
            var retval = StlCacheManager.Get <List <TagInfo> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <List <TagInfo> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.TagDao.GetTagInfoList(siteId, contentId, isOrderByCount, totalNum);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static DataSet GetDataSet(string connectionString, string queryString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlDatabaseCache), nameof(GetDataSet),
                                                       connectionString, queryString);
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.DatabaseDao.GetDataSet(connectionString, queryString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #10
0
        public static DataSet GetStlDataSourceChecked(List <int> channelIdList, string tableName, int startNum, int totalNum, string orderByString, string whereString, NameValueCollection others)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlDataSourceChecked),
                                                       TranslateUtils.ObjectCollectionToString(channelIdList), tableName, startNum.ToString(), totalNum.ToString(), orderByString, whereString, TranslateUtils.NameValueCollectionToString(others));
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlDataSourceChecked(channelIdList, tableName, startNum, totalNum, orderByString, whereString, others);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #11
0
        public static List <int> GetContentIdListChecked(string tableName, int channelId, string orderByFormatString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetContentIdListChecked),
                                                       tableName, channelId.ToString(), orderByFormatString);
            var retval = StlCacheManager.Get <List <int> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <List <int> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetContentIdListChecked(tableName, channelId, orderByFormatString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static DataSet GetStlDataSet(List <int> channelIdList, int startNum, int totalNum, string whereString, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetStlDataSet),
                                                       TranslateUtils.ObjectCollectionToString(channelIdList), startNum.ToString(), totalNum.ToString(), whereString, orderByString);
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetStlDataSet(channelIdList, startNum, totalNum, whereString, orderByString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static DataSet GetStlDataSourceBySiteId(int siteId, int startNum, int totalNum, string whereString, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetStlDataSourceBySiteId),
                                                       siteId.ToString(), startNum.ToString(), totalNum.ToString(), whereString, orderByString);
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetStlDataSourceBySiteId(siteId, startNum, totalNum, whereString, orderByString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static ChannelInfo GetChannelInfoByTaxis(int channelId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetChannelInfoByTaxis),
                                                       channelId.ToString());
            var retval = StlCacheManager.Get <ChannelInfo>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <ChannelInfo>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetChannelInfoByTaxis(channelId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Beispiel #15
0
        public static List <int> GetContentIdListByTagCollection(StringCollection tagCollection, int siteId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlTagCache),
                                                       nameof(GetContentIdListByTagCollection), TranslateUtils.ObjectCollectionToString(tagCollection),
                                                       siteId.ToString());
            var retval = StlCacheManager.Get <List <int> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <List <int> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.TagDao.GetContentIdListByTagCollection(tagCollection, siteId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static string GetStlPageSqlString(string sqlString, string orderByString, int totalNum, int pageNum, int currentPageIndex)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlDatabaseCache), nameof(GetStlPageSqlString),
                                                       sqlString, orderByString, totalNum.ToString(), pageNum.ToString(), currentPageIndex.ToString());
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.DatabaseDao.GetStlPageSqlString(sqlString, orderByString, totalNum, pageNum,
                                                                          currentPageIndex);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }