protected override string MaxCacheKey <TResult>(Expression <Func <T, TResult> > selector, ISpecification <T> criteria) { if (TryPartitionValue(criteria, out TPartition partition)) { return ($"{FullCachePrefix}/{TypeFullName}/p:{partition}/{GetPartitionGeneration(partition)}/Max/{Md5Helper.CalculateMd5(typeof(TResult).FullName + "::" + selector + "::" + criteria)}"); } return ($"{FullCachePrefix}/{TypeFullName}/{GetGeneration()}/Max/{Md5Helper.CalculateMd5(typeof(TResult).FullName + "::" + selector + "::" + criteria)}"); }
protected override string LongCountCacheKey(ISpecification <T> criteria) { if (TryPartitionValue(criteria, out TPartition partition)) { return ($"{FullCachePrefix}/{TypeFullName}/p:{partition}/{GetPartitionGeneration(partition)}/LongCount/{Md5Helper.CalculateMd5(criteria == null ? "null" : criteria.ToString())}"); } return ($"{FullCachePrefix}/{TypeFullName}/{GetGeneration()}/LongCount/{Md5Helper.CalculateMd5(criteria == null ? "null" : criteria.ToString())}"); }
protected override string GroupCacheKey <TGroupKey, TResult>(Expression <Func <T, TGroupKey> > keySelector, Expression <Func <IGrouping <TGroupKey, T>, TResult> > resultSelector, ISpecification <T> criteria) { if (TryPartitionValue(criteria, out TPartition partition)) { return ($"{FullCachePrefix}/{TypeFullName}/p:{partition}/{GetPartitionGeneration(partition)}/Group/{Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName + "::" + resultSelector + "::" + typeof(TResult).FullName)}"); } return ($"{FullCachePrefix}/{TypeFullName}/{GetGeneration()}/Group/{Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName + "::" + resultSelector + "::" + typeof(TResult).FullName)}"); }
protected override string FindCacheKey <TResult>(ISpecification <T> criteria, IQueryOptions <T> queryOptions, Expression <Func <T, TResult> > selector) { if (TryPartitionValue(criteria, out TPartition partition)) { return ($"{FullCachePrefix}/{TypeFullName}/p:{partition}/{GetPartitionGeneration(partition)}/Find/{Md5Helper.CalculateMd5(criteria + "::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null"))}"); } return ($"{FullCachePrefix}/{TypeFullName}/{GetGeneration()}/Find/{Md5Helper.CalculateMd5(criteria + "::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null"))}"); }
protected virtual string GroupLongCountsCacheKey <TGroupKey>(Func <T, TGroupKey> keySelector, ISpecification <T> criteria) { return(String.Format("{0}/{1}/{2}/{3}", FullCachePrefix, TypeFullName, "GroupLongCounts", Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName))); }
protected virtual string LongCountCacheKey(ISpecification <T> criteria) { return(String.Format("{0}/{1}/{2}/{3}", FullCachePrefix, TypeFullName, "LongCount", Md5Helper.CalculateMd5(criteria == null ? "null" : criteria.ToString()))); }
protected virtual string FindCacheKey <TResult>(ISpecification <T> criteria, IQueryOptions <T> queryOptions, Expression <Func <T, TResult> > selector) { return(String.Format("{0}/{1}/{2}/{3}", FullCachePrefix, TypeFullName, "Find", Md5Helper.CalculateMd5(criteria + "::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null")))); }
protected virtual string GetAllCacheKey <TResult>(IQueryOptions <T> queryOptions, Expression <Func <T, TResult> > selector) { return(String.Format("{0}/{1}/{2}", FullCachePrefix, TypeFullName, Md5Helper.CalculateMd5("All::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null")))); }
protected string GetWriteThroughCacheKey <TResult>(TKey key, Expression <Func <T, TResult> > selector) { return(String.Format("{0}/{1}/{2}/{3}", FullCachePrefix, TypeFullName, key, Md5Helper.CalculateMd5("Get::" + (selector != null ? selector.ToString() : "null")))); }
protected override string FindCacheKey <TResult>(ISpecification <T> criteria, IQueryOptions <T> queryOptions, Expression <Func <T, TResult> > selector) { if (TryPartitionValue(criteria, out TPartition partition)) { return(String.Format("{0}/{1}/p:{2}/{3}/{4}/{5}", FullCachePrefix, TypeFullName, partition, GetPartitionGeneration(partition), "Find", Md5Helper.CalculateMd5(criteria + "::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null")))); } return(String.Format("{0}/{1}/{2}/{3}/{4}", FullCachePrefix, TypeFullName, GetGeneration(), "Find", Md5Helper.CalculateMd5(criteria + "::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null")))); }
protected override string GetAllCacheKey <TResult>(IQueryOptions <T> queryOptions, Expression <Func <T, TResult> > selector) { return ($"{FullCachePrefix}/{TypeFullName}/{GetGeneration()}/{Md5Helper.CalculateMd5("All::" + (queryOptions != null ? queryOptions.ToString() : "null") + "::" + (selector != null ? selector.ToString() : "null"))}"); }
protected override string MaxCacheKey <TResult>(Expression <Func <T, TResult> > selector, ISpecification <T> criteria) { if (TryPartitionValue(criteria, out TPartition partition)) { return(String.Format("{0}/{1}/p:{2}/{3}/{4}/{5}}", FullCachePrefix, TypeFullName, partition, GetPartitionGeneration(partition), "Max", Md5Helper.CalculateMd5(typeof(TResult).FullName + "::" + selector + "::" + criteria))); } return(String.Format("{0}/{1}/{2}/{3}/{4}", FullCachePrefix, TypeFullName, GetGeneration(), "Max", Md5Helper.CalculateMd5(typeof(TResult).FullName + "::" + selector + "::" + criteria))); }
protected override string GroupCacheKey <TGroupKey, TResult>(Expression <Func <T, TGroupKey> > keySelector, Expression <Func <IGrouping <TGroupKey, T>, TResult> > resultSelector, ISpecification <T> criteria) { if (TryPartitionValue(criteria, out TPartition partition)) { return(String.Format("{0}/{1}/p:{2}/{3}/{4}/{5}}", FullCachePrefix, TypeFullName, partition, GetPartitionGeneration(partition), "Group", Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName + "::" + resultSelector + "::" + typeof(TResult).FullName))); } return(String.Format("{0}/{1}/{2}/{3}/{4}", FullCachePrefix, TypeFullName, GetGeneration(), "Group", Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName + "::" + resultSelector + "::" + typeof(TResult).FullName))); }
protected override string LongCountCacheKey(ISpecification <T> criteria) { if (TryPartitionValue(criteria, out TPartition partition)) { return(String.Format("{0}/{1}/p:{2}/{3}/{4}/{5}", FullCachePrefix, TypeFullName, partition, GetPartitionGeneration(partition), "LongCount", Md5Helper.CalculateMd5(criteria == null ? "null" : criteria.ToString()))); } return(String.Format("{0}/{1}/{2}/{3}/{4}", FullCachePrefix, TypeFullName, GetGeneration(), "LongCount", Md5Helper.CalculateMd5(criteria == null ? "null" : criteria.ToString()))); }
protected virtual string GroupCacheKey <TGroupKey, TResult>(Expression <Func <T, TGroupKey> > keySelector, Expression <Func <IGrouping <TGroupKey, T>, TResult> > resultSelector, ISpecification <T> criteria) { return(String.Format("{0}/{1}/{2}/{3}", FullCachePrefix, TypeFullName, "Group", Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName + "::" + resultSelector + "::" + typeof(TResult).FullName))); }
protected virtual string MaxCacheKey <TResult>(Expression <Func <T, TResult> > selector, ISpecification <T> criteria) { return(String.Format("{0}/{1}/{2}/{3}", FullCachePrefix, TypeFullName, "Max", Md5Helper.CalculateMd5(typeof(TResult).FullName + "::" + selector + "::" + criteria))); }
protected override string GroupCountsCacheKey <TGroupKey>(Func <T, TGroupKey> keySelector, ISpecification <T> criteria) { TPartition partition; if (TryPartitionValue(criteria, out partition)) { return(String.Format("{0}/{1}/p:{2}/{3}/{4}/{5}}", FullCachePrefix, TypeFullName, partition, GetPartitionGeneration(partition), "GroupCounts", Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName))); } return(String.Format("{0}/{1}/{2}/{3}/{4}", FullCachePrefix, TypeFullName, GetGeneration(), "GroupCounts", Md5Helper.CalculateMd5((criteria == null ? "null" : criteria.ToString()) + "::" + keySelector + "::" + typeof(TGroupKey).FullName))); }