public TResult TryGetValue <TResult>(string key, Func <TResult> value, IHttpCacheConfig config = null) { if (_cache[key] != null) { return((TResult)_cache[key]); } HttpCacheConfig manual = config as HttpCacheConfig; if (manual != null) { bool isInit = false; TResult res = default(TResult); LazyInitializer.EnsureInitialized(ref res, ref isInit, ref _sync, () => value.Invoke()); _cache.Insert(key, res, manual.Dependency, manual.AbsoluteExpiration, manual.SlidingExpiration, manual.Priority, manual.Callback); } return((TResult)_cache[key]); }
public TResult TryGetValue <TResult>(string key, Expression <Func <TResult> > value, IHttpCacheConfig config) { if (_cache[key] != null) { return((TResult)_cache[key]); } HttpCacheConfig manual = config as HttpCacheConfig; if (manual != null) { _cache.Insert(key, value.Compile().Invoke(), manual.Dependency, manual.AbsoluteExpiration, manual.SlidingExpiration, manual.Priority, manual.Callback); } return((TResult)_cache[key]); }