apache / apache/grails-core

Add `unless` option to Cacheable

Open
#14,170 4 comments 2 reactions 0 assignees View on GitHub
relates-to: grails-cache
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

I have some cache conditions where the value can only be cached if the value is not null.
Apparently there is now way to do it in version 4, since the result of the method call can not be accessed inside the condition closure.

Before, I had the following condition: "#result != null", now I would need to rewrite it to something like
`{
result != null
}`

Contributor guide

Open the contributing guide

Research direction

Start by locating the Cacheable entry point and reading how version 4 evaluates its condition closure. Compare that behavior with the reported former "#result != null" condition. Done means an unless option can express the non-null result case and the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.