private Task <TFuncResult> ExecuteCacheOrGetAsync <TRequest, TResult, TFuncResult>( IStoredProc <TRequest, TResult> sp, TRequest parameters, Func <Task <TFuncResult> > getResultFunc) { return(EnableCache(sp) ? _cache.GetOrCreateAsync( sp.GetParameters(parameters).CreateCacheKey(sp.StoredProcedureName), sp.CacheLifetime, getResultFunc) : getResultFunc()); }
private TFuncResult ExecuteCacheOrGet <TRequest, TResult, TFuncResult>( IStoredProc <TRequest, TResult> sp, TRequest parameters, Func <TFuncResult> getResultFunc, string cacheKey = "") { return(EnableCache(sp) ? _cache.GetOrCreate(string.IsNullOrEmpty(cacheKey) ? sp.GetParameters(parameters).CreateCacheKey(sp.StoredProcedureName) : cacheKey, sp.CacheLifetime, getResultFunc) : getResultFunc()); }