tenantcloud / laravel-better-cache
Improvements for Laravel's cache
Installs: 16 554
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 4
Forks: 0
Open Issues: 1
Requires
- php: >=8.1
- illuminate/cache: ^9.0|^10.0
- illuminate/contracts: ^9.0|^10.0
Requires (Dev)
- nunomaduro/larastan: ^2.6
- orchestra/testbench: ^8.15
- pestphp/pest: ^1.0|^2.8
- php-cs-fixer/shim: ~3.19.2
- phpstan/phpstan: ~1.10.21
- phpstan/phpstan-mockery: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- phpstan/phpstan-webmozart-assert: ^1.2
- predis/predis: ^2.0
- tenantcloud/php-cs-fixer-rule-sets: ~3.0.0
- timacdonald/log-fake: ^2.0
This package is auto-updated.
Last update: 2024-11-14 20:53:59 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