Example #1
0
        public V GetSync <K, V>(KVCacheVisitor visitor, Func <K, V> creator, K key)
        {
            var prefix      = GetPrefix(visitor.Name, typeof(K), typeof(V));
            var realService = getRealService(visitor.CacheType);

            return(realService.GetSync(visitor.CacheConfiguration,
                                       () =>
            {
                return creator(key);
            }
                                       , prefix, key));
        }
Example #2
0
        public async Task <V> Get <K, V>(KVCacheVisitor visitor, Func <K, Task <V> > creator, K key)
        {
            var prefix      = GetPrefix(visitor.Name, typeof(K), typeof(V));
            var realService = getRealService(visitor.CacheType);

            return(await realService.Get(visitor.CacheConfiguration,
                                         async() =>
            {
                return await creator(key);
            }
                                         , prefix, key));
        }