tenantcloud / laravel-better-cache
Improvements for Laravel's cache
Installs: 21 853
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=8.3
- illuminate/cache: ^10.0|^11.0|^12.0
- illuminate/contracts: ^12.0
Requires (Dev)
- nunomaduro/larastan: ^3.0
- orchestra/testbench: ^10.0
- pestphp/pest: ^3.8
- php-cs-fixer/shim: ^3.75
- phpstan/phpstan: ^2.1.17
- phpstan/phpstan-mockery: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-webmozart-assert: ^2.0
- predis/predis: ^2.0
- tenantcloud/php-cs-fixer-rule-sets: ^3.4.1
- timacdonald/log-fake: ^2.0
This package is auto-updated.
Last update: 2025-06-28 13:25:34 UTC
README
Fail safe
Laravel's implementation of cache doesn't allow failures - if your Redis dies, your app dies too.
New fail_safe
driver aims to solve this by catching and logging all exceptions and instead
returning null/false as if the value was simply not found in cache:
// config/cache.php [ 'fail_safe' => [ 'delegate' => [ 'driver' => 'redis', 'connection' => 'cache', 'lock_connection' => 'default', ] ] ] // code Cache::forever('key', 'value'); // redis died here Cache::get('key'); // returns null and logs the exception