private async Task <object> TaskFetchAsync(ICacheTask task, string cacheKey) { if (!_store.Has(cacheKey) || task.IsExpired(this)) { await task.Run(this, (k, v) => _store.Save(k, v)).ConfigureAwait(false); } return(_store.Get(cacheKey)); }
private async Task <T> GetFirstAsync <T>(ICache cache, ICacheTask <T> task, IDictionary <string, object> items) where T : class { void Save(string key, object value) { items[key] = value; } await task.Run(cache, Save).ConfigureAwait(false); return(((IEnumerable <T>)items.First().Value).First()); }
public bool TryGetTask(string taskKey, out ICacheTask task) { return(_tasks.TryGetValue(taskKey, out task)); }