public Task <Icon> GetIconAsync(string type, int?typeId = null, string color = null, int?imageId = null) { var iconType = ValidateInputParameter(type, typeId, color); var cacheKey = GetIconCacheKey(type, typeId, color, imageId); return(_cache.AddOrGetExistingAsync(cacheKey, () => GetIconAsync(iconType, typeId, color), _defaultExpirationOffset)); }
protected async Task <Session> GetAccessAsync(HttpRequestMessage request) { var sessionToken = GetHeaderSessionToken(request); if (string.IsNullOrWhiteSpace(sessionToken)) { throw new ArgumentNullException(nameof(sessionToken)); } var session = await _cache.AddOrGetExistingAsync(sessionToken, () => GetSessionFromAccessControl(sessionToken), DateTimeOffset.UtcNow.Add(SessionsCacheSettings.SessionCacheExpiration)); return(session); }
public Task <IDictionary <string, bool> > GetFeaturesAsync() { return(_cache.AddOrGetExistingAsync(CacheKey, LoadFeaturesAsync, DateTimeOffset.UtcNow.Add(CacheAbsoluteExpirationTime))); }