prismicio-community / php-kit

Community maintained development kit for Prismic and the PHP language
https://prismic.io
Other
109 stars 83 forks source link

Add CacheInterface#has method #89

Closed tremby closed 9 years ago

tremby commented 9 years ago

Rationale: though to my knowledge Prismic never caches a null value, it is possible for caches to store null and for that to be different from the key not existing in cache. Adding a has method to the CacheInterface allows developers to provide a more reliable way to tell these apart, if available for the cache backend. This also leads to a fuller cache interface. In many cases (especially if the value is large, as some will be in Prismic) checking if a key exists in cache can be much faster than retrieving the value and checking against null.