Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caching null-values

Tags:

java

I'm having an argument with my chief architect about caching null-values. His opinion is, that null-values by definition aren't cached.

My problem now is, that there is always a cache-miss and a piece of code is always entered without any need, since the null value is totally fine in my case.

My question: Is there an official definition on this case?

like image 597
user871611 Avatar asked Apr 30 '13 07:04

user871611


1 Answers

I doubt there is an official document for this case as the answer strongly depends on your usage. For instance imagine you have a web query taking 200 ms to be processed that returns null and that is a valid value. Of course you would cache this to avoid these extra 200 ms everytime you do the query.

I am personally with you on the case. Rules saying never do... are rarely without an exception.

like image 82
Ivaylo Strandjev Avatar answered Sep 23 '22 18:09

Ivaylo Strandjev