Skip to content

Allow null values pattern #343

Answered by MichaCo
fabionaspolini asked this question in Q&A
Discussion options

You must be logged in to vote

Because of the architecture of CacheManager, storing null doesn't work.
For memory caches only, yeah that would not be a problem.
But, because CacheManager has to support distributed caching with serialization, just passing in null will be impossible to compute if the object cache is being used, because you cannot infer the real type if you just pass in null for an object.

If I would redesign the library with a new API, I'd probably drop the object support and have only one non typed cache with a generic interface. And then, nulls could be supported.

But no, for now that's by design.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by MichaCo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #301 on May 31, 2021 03:59.