cvsouth / cache-null
Enables support for caching of null values in Laravel
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 1 325
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- illuminate/support: 5.5.*|5.6.*|5.7.*|5.8.*|6.0.*|^7.0|^8.0|^9.0
README
By default in Laravel, as per PSR-16, cached null values are inistingustable from a cache miss:
A cache miss will return null and therefore detecting if one stored null is not possible.
Cache::forever('test1a', null); $exists = Cache::has('test1a'); // returns FALSE $value = Cache::rememberForever('test1b', function() { print('calculating'); return null; }); // 'calculating' prints every single time
Install this package if you want to enable support for caching null values:
Cache::forever('test2a', null); $exists = Cache::has('test2a'); // returns TRUE $value = Cache::rememberForever('test2b', function() { print('calculating'); return null; }); // 'calculating' prints only the first time
Installation
composer require cvsouth/cache-null
Notices
The only cache driver currently supported by this package is redis
.