public CacheValueWrapper <TValue> GetValue(TKey key) { CacheValueWrapper <TValue> value; if (_context.CacheContext.Cache.TryGetObject(GenerateKeyString(key), out value)) { return(value); } return(CacheValueWrapper <TValue> .CreateMissing()); }
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()); }