-
Notifications
You must be signed in to change notification settings - Fork 7
[NAE-2400] Prevent Caching of Null Results in Process Cache #427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
746d40f
dae8fc3
3653f03
c3b91da
39782d8
752370d
796b49e
2843d3d
ba199dd
dfc012f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,6 +138,15 @@ public void evictAllCaches() { | |
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetByIdentifier()), cacheProperties.getPetriNetByIdentifier()).clear(); | ||
| } | ||
|
|
||
| @Override | ||
| public void evictCache(String id, String identifier, String version) { | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetById()), cacheProperties.getPetriNetById()).evict(id); | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetDefault()), cacheProperties.getPetriNetDefault()).evict(identifier); | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetLatest()), cacheProperties.getPetriNetLatest()).evict(identifier); | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetCache()), cacheProperties.getPetriNetCache()).evict(new ObjectId(id)); | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetByIdentifier()), cacheProperties.getPetriNetByIdentifier()).evict(identifier + version); | ||
| } | ||
|
|
||
| public void evictCache(PetriNet net) { | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetById()), cacheProperties.getPetriNetById()).evict(net.getStringId()); | ||
| requireNonNull(cacheManager.getCache(cacheProperties.getPetriNetDefault()), cacheProperties.getPetriNetDefault()).evict(net.getIdentifier()); | ||
|
|
@@ -150,7 +159,7 @@ public void evictCache(PetriNet net) { | |
| * Get read only Petri net. | ||
| */ | ||
| @Override | ||
| @Cacheable(value = "petriNetCache") | ||
| @Cacheable(value = "petriNetCache", unless = "#result == null") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
At Line 153 and Line 304, both methods throw on not-found instead of returning Based on learnings: In this repository, Also applies to: 304-304 🤖 Prompt for AI Agents |
||
| public PetriNet get(ObjectId petriNetId) { | ||
| Optional<PetriNet> optional = repository.findById(petriNetId.toString()); | ||
| if (optional.isEmpty()) { | ||
|
|
@@ -301,7 +310,7 @@ protected final Optional<PetriNet> doSaveInternal(PetriNet petriNet) { | |
| } | ||
|
|
||
| @Override | ||
| @Cacheable(value = "petriNetById") | ||
| @Cacheable(value = "petriNetById", unless = "#result == null") | ||
| public PetriNet getPetriNet(String id) { | ||
| Optional<PetriNet> net = repository.findById(id); | ||
| if (net.isEmpty()) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.