简体   繁体   中英

Redis - Get all Keys begining with

I'm using TinyRedisClient with PHP for making calls to my redis database.

I'm looking to GET all keys that being with Player:

There are multiple keys such as Player:17364633 Player:12435435 How would I get these by only knowing they begin with Player: ?

Thanks

You can use the KEYS command to fetch a list of keys, and then GET each of them:

redis> KEYS Player:*
1) "Player:17364633"
2) "Player:12435435"
redis> GET Player:17364633
...

You can even do a little bit better by using MGET to fetch all the values at once.

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