Looking to hire Laravel developers? Try LaraJobs

laravel-better-cache maintained by tenantcloud

Description
Improvements for Laravel's cache
Last update
2025/06/28 15:11 (dev-alpha)
License
Links
Downloads
27 882

Comments
comments powered by Disqus

Better cache for Laravel

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