Beispiel #1
0
 public Task <ISchemaEntity?> GetSchemaAsync(DomainId appId, string name)
 {
     return(localCache.GetOrCreateAsync($"GetSchemaAsync({appId}, {name})", async() =>
     {
         return await indexSchemas.GetSchemaByNameAsync(appId, name);
     }));
 }
Beispiel #2
0
        public async Task <ISchemaEntity?> GetSchemaAsync(DomainId appId, string name, bool canCache = false)
        {
            var schema = await localCache.GetOrCreateAsync(SchemaCacheKey(appId, name), () =>
            {
                return(indexSchemas.GetSchemaByNameAsync(appId, name, canCache));
            });

            if (schema != null)
            {
                localCache.Add(SchemaCacheKey(appId, schema.Id), schema);
            }

            return(schema?.IsDeleted == true ? null : schema);
        }
Beispiel #3
0
        public async Task <ISchemaEntity?> GetSchemaAsync(DomainId appId, string name, bool canCache = false)
        {
            var cacheKey = SchemaCacheKey(appId, name);

            if (localCache.TryGetValue(cacheKey, out var cached) && cached is ISchemaEntity found)
            {
                return(found);
            }

            var schema = await indexSchemas.GetSchemaByNameAsync(appId, name, canCache);

            if (schema != null)
            {
                localCache.Add(cacheKey, schema);
                localCache.Add(SchemaCacheKey(appId, schema.Id), schema);
            }

            return(schema);
        }