public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext) { if (TargetMethodReturnsVoid(input)) { return(getNext()(input, getNext)); } object[] inputs = new object[input.Inputs.Count]; for (int i = 0; i < inputs.Length; ++i) { inputs[i] = input.Inputs[i]; } string cacheKey = KeyGenerator.CreateCacheKey(input.MethodBase, inputs); object[] cachedResult = (object[])HttpRuntime.Cache.Get(cacheKey); if (cachedResult == null) { IMethodReturn realReturn = getNext()(input, getNext); if (realReturn.Exception == null) { AddToCache(cacheKey, realReturn.ReturnValue); } return(realReturn); } IMethodReturn cachedReturn = input.CreateMethodReturn(cachedResult[0], input.Arguments); return(cachedReturn); }