Ejemplo n.º 1
0
        private async Task <GraphQLModel> GetModelAsync(IAppEntity app)
        {
            var cacheKey = CreateCacheKey(app.Id);

            var modelContext = Cache.Get <GraphQLModel>(cacheKey);

            if (modelContext == null)
            {
                var allSchemas = await schemaRepository.QueryAllAsync(app.Id);

                modelContext = new GraphQLModel(app, allSchemas.Where(x => x.IsPublished), urlGenerator);

                Cache.Set(cacheKey, modelContext, CacheDuration);
            }

            return(modelContext);
        }
Ejemplo n.º 2
0
        private async Task <GraphQLModel> GetModelAsync(IAppEntity app)
        {
            var cacheKey = CreateCacheKey(app.Id, app.Etag);

            var modelContext = Cache.Get <GraphQLModel>(cacheKey);

            if (modelContext == null)
            {
                var allSchemas = await appProvider.GetSchemasAsync(app.Name);

                modelContext = new GraphQLModel(app, allSchemas.Where(x => x.IsPublished), urlGenerator);

                Cache.Set(cacheKey, modelContext, CacheDuration);
            }

            return(modelContext);
        }