micronaut-projects / micronaut-projects/micronaut-cache
Null values are not cached
- Dominant language
- PLSQL
- Stars
- 32
- Forks
- 36
- Avg merge
- 2h 2m
- Merged PRs (30d)
- 5
Description
Is it intended that `null` value is not cached?
I think it has to be configurable, because `null` is valid value for me, or am I missing something?
Example:
```kotlin
@Cacheable("test")
fun getCompanyForUser(id: Long): String? {
// implementation
}
```
Not every user has to have company, but when the method returns `null`, it's not cached, but called every time. I didn't even find this behaviour documented.
I am using `io.micronaut.cache:micronaut-cache-caffeine:2.0.0.M2`.
Contributor guide
Research direction
Start with the Kotlin @Cacheable example and the reported micronaut-cache-caffeine 2.0.0.M2 behavior, then trace how null results are handled. Done means the null-caching behavior can be configured and the behavior is documented, with coverage for the example scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100