public Task <IAppEntity?> GetAppAsync(string appName) { return(localCache.GetOrCreateAsync($"GetAppAsync({appName})", async() => { return await indexForApps.GetAppByNameAsync(appName); })); }
public async Task <IAppEntity?> GetAppAsync(string appName, bool canCache = false) { var app = await localCache.GetOrCreateAsync(AppCacheKey(appName), () => { return(indexForApps.GetAppByNameAsync(appName, canCache)); }); if (app != null) { localCache.Add(AppCacheKey(app.Id), app); } return(app?.IsArchived == true ? null : app); }
public async Task <IAppEntity?> GetAppAsync(string appName, bool canCache = false) { var cacheKey = AppCacheKey(appName); if (localCache.TryGetValue(cacheKey, out var cached) && cached is IAppEntity found) { return(found); } var app = await indexForApps.GetAppByNameAsync(appName, canCache); if (app != null) { localCache.Add(cacheKey, app); localCache.Add(AppCacheKey(app.Id), app); } return(app); }