示例#1
0
        public CacheValueWrapper <TValue> GetValue(TKey key)
        {
            CacheValueWrapper <TValue> value;

            if (_context.CacheContext.Cache.TryGetObject(GenerateKeyString(key), out value))
            {
                return(value);
            }
            return(CacheValueWrapper <TValue> .CreateMissing());
        }
示例#2
0
        private CacheValueWrapper <TValue> LoadValue(TKey k)
        {
            TValue rawValue;

            if (_dataSource.TryGetValue(k, out rawValue))
            {
                return(CacheValueWrapper <TValue> .CreateExisting(rawValue, _ttl));
            }
            return(CacheValueWrapper <TValue> .CreateNotFound(_ttl)); //not found value will be cached
        }
        public CacheValueWrapper <TValue> GetValue(TKey key)
        {
            CacheValueWrapper <TValue> value;

            if (_store.TryGetValue(key, out value))
            {
                return(value);
            }
            return(CacheValueWrapper <TValue> .CreateMissing());
        }