Skip to content

How to use cache clear without resetting RateLimiter #54305

Closed Answered by blackjak231
blackjak231 asked this question in Q&A
Discussion options

You must be logged in to vote

Solved it on my own.
For anyone looking for an answer to this :

When using php artisan cache:clear, Laravel actually only clears the default cache. This means that it will only clear the "cache" connection configured, which uses db 1.

The easy solution was to create a new DB connection that uses redis db 2. In my case, I called it persistent :

// config/database.php

// ..

    'redis' => [

        // ...

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_CACHE_DB', '1'),
        ],
   …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by blackjak231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant