diff --git a/.env.example b/.env.example index d0b8b81bcfa87727379ddd8c9db66e8032235303..49f4b2692c1c6b2746cb8b648b62ec34b86749cd 100644 --- a/.env.example +++ b/.env.example @@ -15,7 +15,7 @@ REDIS_RESULT_CONNECTION=default REDIS_RESULT_CACHE_DURATION=60 BROADCAST_DRIVER=log -CACHE_DRIVER=database +CACHE_DRIVER=redis SESSION_DRIVER=file QUEUE_CONNECTION=sync diff --git a/app/Console/Commands/CacheGC.php b/app/Console/Commands/CacheGC.php deleted file mode 100644 index d5bb265f25c1fc6f2c721b2e0b5492ac7cf3d3ab..0000000000000000000000000000000000000000 --- a/app/Console/Commands/CacheGC.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace App\Console\Commands; - -use DB; -use Illuminate\Console\Command; - -class CacheGC extends Command -{ - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'cache:gc'; - - /** - * The console command description. - * - * @var string - */ - protected $description = 'Cleans up every expired cache File'; - - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - } - - /** - * Execute the console command. - * - * @return mixed - */ - public function handle() - { - DB::delete('delete from cache where cache.expiration < unix_timestamp()'); - } -} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 97ce1d64f4353c535360221484de3219966fcd36..decf0ba0c2c94d37c3a61365b1236a7c5e7ec965 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -27,7 +27,6 @@ class Kernel extends ConsoleKernel { $schedule->command('requests:gather')->everyFifteenMinutes(); $schedule->command('requests:useragents')->everyFiveMinutes(); - $schedule->command('cache:gc')->hourly(); $schedule->call(function () { DB::table('monthlyrequests')->truncate(); diff --git a/composer.json b/composer.json index 16e10a04a2fa8053e329560b08ff11bf0f631843..2f226d4725f83c9a6b08fd8488c71ef51ece476e 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "laravel/tinker": "^1.0", "mcamara/laravel-localization": "^1.3", "mews/captcha": "^2.2", + "monospice/laravel-redis-sentinel-drivers": "^2.6", "predis/predis": "^1.1", "symfony/dom-crawler": "^4.1" }, diff --git a/config/cache.php b/config/cache.php index 009ab29bae5e21ea3b2e7c17daa4e772fc8abc96..6138e970a063774c061b339b99c7dd925f098ada 100644 --- a/config/cache.php +++ b/config/cache.php @@ -69,8 +69,8 @@ return [ ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', + 'driver' => env('REDIS_CACHE_DRIVER', 'redis'), + 'connection' => 'cache', ], ], diff --git a/config/database.php b/config/database.php index e5cd2aee9d14596cb17db04ab31894cccda43965..44b5fca6befe3141873a5163dec59a13a3695e6e 100644 --- a/config/database.php +++ b/config/database.php @@ -118,6 +118,13 @@ return [ 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], + + 'cache' => [ + 'host' => env('REDIS_CACHE_HOST', 'localhost'), + 'password' => env('REDIS_CACHE_PASSWORD', null), + 'port' => env('REDIS_CACHE_PORT', 6379), + 'database' => 0, + ], ], ];