Пример #1
0
        /// <summary>
        /// Gets the Cached result of the function based on the Invocation Name (Cache Key)
        /// </summary>
        /// <param name="invocation"></param>
        /// <param name="dependencyCacheKey"></param>
        /// <returns></returns>
        private object GetCachedResult(IInvocation invocation, string dependencyCacheKey)
        {
            var cacheKey      = GetCacheItemKey(invocation);
            var cacheSettings = CreateCacheSettings(cacheKey, dependencyCacheKey);

            // Add dependencies to output caching
            mOutputCacheDependencies.AddCacheItemDependencies(dependencyCacheKey.Split(TextHelper.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries));

            Func <Object> provideData = () =>
            {
                invocation.Proceed();
                return(invocation.ReturnValue);
            };

            return(CacheHelper.Cache(provideData, cacheSettings));
        }