public IVolatileToken When(string key, TimeSpan duration) { var token = new AbsoluteExpirationToken(this, duration); timeCache[key] = token; return(token); }
public IVolatileToken WhenUtc(string key, DateTime absoluteUtc) { var token = new AbsoluteExpirationToken(this, absoluteUtc); timeCache[key] = token; return(token); }
private void _timer_Elapsed(object sender, ElapsedEventArgs e) { foreach (KeyValuePair <string, IVolatileToken> token in timeCache) { if (!token.Value.IsCurrent) { IVolatileToken _token = new AbsoluteExpirationToken(this, TimeSpan.Zero); EngineContext.Current.Resolve <ICacheClient>().Remove(token.Key); timeCache.TryRemove(token.Key, out _token); } } }
private void _timer_Elapsed(object sender, ElapsedEventArgs e) { foreach (KeyValuePair <string, IVolatileToken> token in timeCache) { if (!token.Value.IsCurrent) { IVolatileToken _token = new AbsoluteExpirationToken(this, TimeSpan.Zero); MemcachedHelper.GetInstance().Remove(token.Key); timeCache.TryRemove(token.Key, out _token); } } }