Related to #88.
Currently, cache.get() returns null on cache miss. This makes it difficult to distinguish between:
- a missing cache entry
- a cached value whose actual value is
null
In 3.x, changing this behavior would be a breaking change, especially since 3.0.0 has already been released. For compatibility, the current plan is to keep cache.get() returning null on miss and support cacheNullValues as an opt-in escape hatch for users who need to cache null as a real value.
For a future major version, we should consider whether cache.get() should return undefined on miss instead, while allowing null to be treated as a regular cacheable value.
Questions to answer:
- Should
cache.get() return undefined on miss in the next major version?
- Should
cache.getOrThrow() behavior remain unchanged?
- How should
mget() represent per-key misses?
- Do we need a separate API that returns
{ found, value } to avoid ambiguity?
- How should this interact with
negativeCache and cacheNullValues?
- How should JSON and msgpack serializer behavior around
undefined be documented or normalized?
This should not be changed in 3.x unless we intentionally decide to introduce a breaking change.
Related to #88.
Currently,
cache.get()returnsnullon cache miss. This makes it difficult to distinguish between:nullIn 3.x, changing this behavior would be a breaking change, especially since 3.0.0 has already been released. For compatibility, the current plan is to keep
cache.get()returningnullon miss and supportcacheNullValuesas an opt-in escape hatch for users who need to cachenullas a real value.For a future major version, we should consider whether
cache.get()should returnundefinedon miss instead, while allowingnullto be treated as a regular cacheable value.Questions to answer:
cache.get()returnundefinedon miss in the next major version?cache.getOrThrow()behavior remain unchanged?mget()represent per-key misses?{ found, value }to avoid ambiguity?negativeCacheandcacheNullValues?undefinedbe documented or normalized?This should not be changed in 3.x unless we intentionally decide to introduce a breaking change.