Onix
Onix

Reputation: 2179

Remove All Keys from Redis in PHP

I was able to flash all keys from terminal using redis-cli flushdb. I have been searching for a while, took me an hour in order to find the simple command to do it in php.

I didn't find it on stackoverflow so I wanted to post it to save someone precious time.

Library Used: Predis

Upvotes: 5

Views: 14277

Answers (2)

zezo pranks
zezo pranks

Reputation: 1

Route::get( '/verify-email/{id}', [
    \App\Http\Controllers\ApiAuth\VerifyEmailController::class,
    'index'
] )->name( 'verification.verify

Upvotes: -2

Onix
Onix

Reputation: 2179

If you have the redis connection you can simply do $redis->flushDB(); to delete all keys from the selected database.

Or if you are using laravel framework you could also do Redis::flushDB();

Upvotes: 11

Related Questions