Ejemplo n.º 1
0
        /// <summary>
        /// Returns an async caching strategy that cached individual items returned from the method by their specified key. The cache source type, method name, and item key will be used for the cache key and the method will be used as the retrieval mechanism for items not found in the cache
        /// </summary>
        public static BulkCacheStrategyAsync <TKey, TResult> Method <T, TKey, TResult>(this Cache <T> cache, Expression <Func <T, Task <ICollection <KeyValuePair <TKey, TResult> > > > > method)
        {
            ExpressionAnalyzer analyzer = new ExpressionAnalyzer();

            return(analyzer.CreateAsyncBulkCacheStrategy(cache, method)
                   .RetrieveUsingMethod());
        }