简体   繁体   中英

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

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM