public async Task <Modifiable> OnHit(ICacheContext context, object result)
        {
            CacheHitContext handlerContext = null;

            foreach (var handlerInfo in GetHandlerInfo(CacheHandlerType.Hit))
            {
                if (handlerContext == null)
                {
                    handlerContext = ((Func <ICacheContext, object, CacheHitContext>)handlerInfo.InitialConstructor)(context, result);
                }
                else
                {
                    handlerContext = ((Func <CacheHitContext, CacheHitContext>)handlerInfo.ContinuationConstructor)(handlerContext);
                }

                await handlerInfo.Handler(handlerContext);
            }

            return((handlerContext ?? new CacheHitContext <object>(context, null)).GetHandlerResult());
        }
Exemplo n.º 2
0
 internal CacheHitContext(CacheHitContext context)
     : base(context)
 {
 }
 public virtual Task OnHit(CacheHitContext context)
 {
     return(Task.FromResult(true));
 }