So in PHP we can do $memcache->get(array('a','b','c'));
I wonder what is the limit of keys before things break. Can I pass 1000 keys? 10000 keys?
I tried to find answer, but can't find anywhere.
Is there someone who have experience in passing large number of keys to do multi-get to memcache?
The maximum length of the key in Memcached has a restriction of 250 bytes.
Memcached get command is used to retrieve the value stored at key. This command takes one or more keys and returns all found items. If the key does not exist in Memcached, then it will return nothing.
The Memcached extension supports at least 100,000 keys in a getMulti, given this test:
php > $data = array_map(function($v){ return 'x' . $v; }, range(1, 100000));
php > foreach($data as $d) { $memcached->add($d, $d); }
php > $multi = $memcached->getMulti($data);
php > echo is_array($multi);
1
php > echo count($multi);
100000
I tried to bump it up to a million, but I hit my configured PHP memory limit and promptly decided that if doing a getMulti of one hundred thousand items isn't good enough, you're probably abusing memcached.
There's no hard limit, but there will be different practical limits that will likely end up being application specific.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With