public static IEnumerable <T> QueryPageCache <T>(this SolrQuery <T> objSolrQuery, string dependencyKey, bool isCache, TimeSpan expiry, string fields, Expression <Func <T, bool> > predicate, string qf, string highlightFields, int pageSize, int pageIndex, string sortExpression, out long recordCount, string bf = "") where T : class, new()
        {
            dependencyKey = objSolrQuery.GetDependencyKey(dependencyKey);
            string text  = objSolrQuery.Condiition(predicate);
            string text2 = string.Concat(new object[]
            {
                objSolrQuery.TableName.ToLower(),
                "SolrPageList",
                fields,
                text,
                qf,
                highlightFields,
                pageSize,
                pageIndex,
                sortExpression,
                bf
            });

            text2 = text2.Replace(" ", "").ToLower();
            IEnumerable <T> result;

            if (isCache)
            {
                PageSolrCache <T> dependencyCache = MemcacheCacheHelper.GetDependencyCache <PageSolrCache <T> >(text2, dependencyKey);
                if (dependencyCache != null)
                {
                    recordCount = dependencyCache.RecordCount;
                    result      = dependencyCache.Data;
                }
                else
                {
                    IEnumerable <T> enumerable = objSolrQuery.QueryPage(fields, text, qf, highlightFields, pageSize, pageIndex, sortExpression, out recordCount, bf);
                    MemcacheCacheHelper.SetDependencyCache(new PageSolrCache <T>
                    {
                        RecordCount = recordCount,
                        Data        = enumerable
                    }, dependencyKey, text2, expiry);
                    result = enumerable;
                }
            }
            else
            {
                SolrCacheBindHelper.DeleteCacheKey(MemcacheCacheHelper.CreateDependencyCacheKey(dependencyKey, text2));
                result = objSolrQuery.QueryPage(fields, text, qf, highlightFields, pageSize, pageIndex, sortExpression, out recordCount, bf);
            }
            return(result);
        }
        public static DataSet QueryDataSetLimitCache <T>(this SolrQuery <T> objSolrQuery, string dependencyKey, bool isCache, TimeSpan expiry, string fields, string condition, string qf, string highlightFields, int offset, int limit, string sortExpression, out long recordCount, string bf = "") where T : class, new()
        {
            dependencyKey = objSolrQuery.GetDependencyKey(dependencyKey);
            string text = string.Concat(new object[]
            {
                objSolrQuery.TableName.ToLower(),
                "SolrDataSetLimit",
                fields,
                condition,
                qf,
                highlightFields,
                offset,
                limit,
                sortExpression,
                bf
            });

            text = text.Replace(" ", "").ToLower();
            DataSet result;

            if (isCache)
            {
                PageSolrCache dependencyCache = MemcacheCacheHelper.GetDependencyCache <PageSolrCache>(text, dependencyKey);
                if (dependencyCache != null)
                {
                    recordCount = dependencyCache.RecordCount;
                    result      = dependencyCache.Data;
                }
                else
                {
                    DataSet dataSet = objSolrQuery.QueryDataSetLimit(fields, condition, qf, highlightFields, offset, limit, sortExpression, out recordCount, bf);
                    MemcacheCacheHelper.SetDependencyCache(new PageSolrCache
                    {
                        RecordCount = recordCount,
                        Data        = dataSet
                    }, dependencyKey, text, expiry);
                    result = dataSet;
                }
            }
            else
            {
                SolrCacheBindHelper.DeleteCacheKey(MemcacheCacheHelper.CreateDependencyCacheKey(dependencyKey, text));
                result = objSolrQuery.QueryDataSetLimit(fields, condition, qf, highlightFields, offset, limit, sortExpression, out recordCount, bf);
            }
            return(result);
        }