Ejemplo n.º 1
0
 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());
 }
Ejemplo n.º 2
0
 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());
 }