laravel-cache-fallback
laravel-cache-fallback copied to clipboard
Support Laravel 9.x
Problem 1 - Root composer.json requires mathieu-bour/laravel-cache-fallback * -> satisfiable by mathieu-bour/laravel-cache-fallback[dev-dependabot/composer/league/flysystem-1.1.4, dev-dependabot/composer/laravel/framework-8.40.0, dev-main, 1.0.0, 9999999-dev]. - mathieu-bour/laravel-cache-fallback[dev-dependabot/composer/league/flysystem-1.1.4, dev-dependabot/composer/laravel/framework-8.40.0, dev-main, 1.0.0] require illuminate/support 5.8.* || ^6.0 || ^7.0 || ^8.0 -> found illuminate/support[v5.8.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but it conflicts with your root composer.json require (^9).
I managed to get this working with Laravel 9.
-
I didn't use composer to install but rather copy/pasted all 3 files from the src folder into my project folder for example in yourCustomFolder\Providers\CacheFallback which is on the same level as the app folder
-
Then I registered the CacheFallbackServiceProvider inside config\app.php
yourCustomFolder\Providers\CacheFallback\CacheFallbackServiceProvider::class
-
after that modify your redis config inside config\cache.php in the redis array add this line
'fallback' => 'file'
-
Update the namespaces in the 3 files you copied for example in RepositoryProxy.php
yourCustomFolder\Providers\CacheFallback
-
Then inside the RepositoryProxy.php update the get method like so on line 83
public function get($key, $default = null): mixed
-
Last step is to add this line inside RepositoryProxy.php just under line 63
$config->set("cache.default", $fallback);
After that you can stop your Redis server and the file cache should be used.
Yes, this library is sadly not compatible with Laravel 9... I'll try to update it this week-end.
any luck?
@andreypopov Did you try my method? I used it at my company and we are using this package now without problems.