R
R
romaaa322018-07-15 10:45:41
PHP
romaaa32, 2018-07-15 10:45:41

How to get all memcached keys?

Memcached::getAllKeys() sends a request to each server and gets an array of all the keys currently stored on it. It's not an atomic operation, so it's not really a consistent snapshot of the keys at a given point in time. Memcache cannot guarantee that all keys will be returned, nor can you rely on all keys being returned.
In what cases can I not get all the keys?
Let's say I have 1000 keys with a user id that store settings. By keys, you need to do a search in the array and do what is indicated in these settings. If the user has deleted the settings, the key is also deleted. You need to get all the keys, but the description of getAllKeys confuses me (

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question