diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs index 221ac18f8..29688c57d 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/HandleRules/EventEnricher.cs @@ -18,7 +18,7 @@ namespace Squidex.Domain.Apps.Core.HandleRules { public sealed class EventEnricher : IEventEnricher { - private static readonly TimeSpan UserCacheDuration = TimeSpan.FromMinutes(10); + private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(10); private readonly IMemoryCache userCache; private readonly IUserResolver userResolver; @@ -56,11 +56,11 @@ namespace Squidex.Domain.Apps.Core.HandleRules private Task FindUserAsync(RefToken actor) { - var key = $"EventEnrichers_Users_{actor.Identifier}"; + var cacheKey = $"{typeof(EventEnricher)}_Users_{actor.Identifier}"; - return userCache.GetOrCreateAsync(key, async x => + return userCache.GetOrCreateAsync(cacheKey, async x => { - x.AbsoluteExpirationRelativeToNow = UserCacheDuration; + x.AbsoluteExpirationRelativeToNow = CacheDuration; IUser? user; try diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs index b2d3087f5..0e01d4153 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Scripting/Internal/Parser.cs @@ -15,40 +15,33 @@ namespace Squidex.Domain.Apps.Core.Scripting.Internal { internal sealed class Parser { - private static readonly TimeSpan Expiration = TimeSpan.FromMinutes(10); + private static readonly TimeSpan CacheDuration = TimeSpan.FromMinutes(10); private static readonly ParserOptions DefaultParserOptions = new ParserOptions { AdaptRegexp = true, Tolerant = true, Loc = true }; - private readonly IMemoryCache memoryCache; + private readonly IMemoryCache cache; - public Parser(IMemoryCache memoryCache) + public Parser(IMemoryCache cache) { - Guard.NotNull(memoryCache, nameof(memoryCache)); + Guard.NotNull(cache, nameof(cache)); - this.memoryCache = memoryCache; + this.cache = cache; } public Script Parse(string script) { - var key = Key(script); + var cacheKey = $"{typeof(Parser)}_Script_{script}"; - if (!memoryCache.TryGetValue