コード例 #1
0
        public static TValue GetValue <TKey, TValue>(this AsyncCache <TKey, TValue> cache, TKey key, Func <TKey, TValue> factory)
        {
            var options = cache.DefaultCacheCallOptions;

            options.Factory      = factory;
            options.AsyncFactory = null;
            return(cache.GetValue(key, options));
        }
コード例 #2
0
        public static async Task <TValue> GetValueAsync <TKey, TValue>(this AsyncCache <TKey, TValue> cache, TKey key, Func <TKey, Task <TValue> > asyncFactory)
        {
            var options = cache.DefaultCacheCallOptions;

            options.Factory      = null;
            options.AsyncFactory = asyncFactory;
            return(await cache.GetValueAsync(key, options));
        }