Mirakurun Mirakurun -5 years ago 272
PHP Question

Redis in PHP: keys "*"

I have searched the Internet up and down, but couldn't find the command how to get all keys from Redis db in php.



When I type
keys "*"
in redis-cli, I get all the keys which are stored in db.


tenshi@mashiro:~$ redis-cli> keys *
1) "Testserver"
2) "testserver"
3) "Server5"

Now I want the similar command in php.

Answer Source

If you're using the PHP extension for redis, then the command is $redis->keys('*')

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download