Пример #1
0
 internal override TResult ExecuteInternal <TResult>(Func <Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
 {
     return(CacheEngine.Implementation <TResult>(
                _syncCacheProvider.For <TResult>(),
                _ttlStrategy.For <TResult>(),
                _cacheKeyStrategy,
                action,
                context,
                cancellationToken,
                _onCacheGet,
                _onCacheMiss,
                _onCachePut,
                _onCacheGetError,
                _onCachePutError));
 }
Пример #2
0
 protected override Task <TResult> ImplementationAsync <TResult>(Func <Context, CancellationToken, Task <TResult> > action, Context context, CancellationToken cancellationToken,
                                                                 bool continueOnCapturedContext)
 {
     return(AsyncCacheEngine.ImplementationAsync <TResult>(
                _asyncCacheProvider.AsyncFor <TResult>(),
                _ttlStrategy.For <TResult>(),
                _cacheKeyStrategy,
                action,
                context,
                cancellationToken,
                continueOnCapturedContext,
                _onCacheGet,
                _onCacheMiss,
                _onCachePut,
                _onCacheGetError,
                _onCachePutError));
 }
Пример #3
0
        internal override TResult ExecuteInternal <TResult>(Func <Context, CancellationToken, TResult> action, Context context, CancellationToken cancellationToken)
        {
            if (_syncCacheProvider == null)
            {
                throw new InvalidOperationException("Please use the synchronous-defined policies when calling the synchronous Execute (and similar) methods.");
            }

            return(CacheEngine.Implementation <TResult>(
                       _syncCacheProvider.For <TResult>(),
                       _ttlStrategy.For <TResult>(),
                       _cacheKeyStrategy,
                       action,
                       context,
                       cancellationToken,
                       _onCacheGet,
                       _onCacheMiss,
                       _onCachePut,
                       _onCacheGetError,
                       _onCachePutError));
        }