Closed
Description
When calling Query.EnableCache in a specification, it seems to expect more than one parameter. If you only pass in a single parameter, then a dash get appended to the key.
So Query.EnableCache("app:settings:123")
results in a key of "app:settings:123-"
We manage our cache keys in a separate file so we can ensure consistency when both setting them and removing them. We don't rely on the Specification object to build the cache key for us because we want to manage that ourselves.
The issue is in the SpecificationBuildExtensions method, in the EnableCache method. Just change this line:
specificationBuilder.Specification.CacheKey = $"{specificationName}-{string.Join("-", args)}";
to something like
specificationBuilder.Specification.CacheKey = $"{string.Join("-", [specificationName, ..args])}";
This way a single parameter won't result in a trailing dash.
Metadata
Metadata
Assignees
Labels
No labels