protected virtual async Task <ApplicationPersonalConfigurationCacheItem> GetPersonalConfigurationCacheItemAsync() { var cacheKey = CalculateCacheKey(CurrentTenant?.Id?.ToString(), CurrentUser?.Id?.ToString()); Logger.LogDebug($"RocketApplicationConfigurationAppService.GetCacheItemAsync: {cacheKey}"); var cacheItem = await _personalConfigurationCache.GetAsync(cacheKey); if (cacheItem != null) { Logger.LogDebug($"Found in the cache: {cacheKey}"); return(cacheItem); } Logger.LogDebug($"Not found in the cache, getting from the repository: {cacheKey}"); cacheItem = new ApplicationPersonalConfigurationCacheItem { Auth = await GetAuthConfigAsync(), Features = await GetFeaturesConfigAsync(), Setting = await GetSettingConfigAsync() }; Logger.LogDebug($"Setting the cache item: {cacheKey}"); await _personalConfigurationCache.SetAsync( cacheKey, cacheItem ); Logger.LogDebug($"Finished setting the cache item: {cacheKey}"); return(cacheItem); }
protected virtual string CalculateCacheKey(string tenantId, string userId) { return(ApplicationPersonalConfigurationCacheItem.CalculateCacheKey(tenantId, userId)); }