Issue
php document discription and example:
public array Memcached::getServerByKey ( string $server_key )
<?php
$m = new Memcached();
$m->addServer('mem1.domain.com', 11211, 33);
$m->addServer('mem2.domain.com', 11211, 67);
?>
I cannot find the server_key param. where is the server_key?
how to use ***bykey functions?
Memcached::addByKey()
Memcached::deleteByKey()
Memcached::getServerByKey()
...
Solution
From http://php.net/manual/en/memcached.getserverbykey.php:
server_key
The key identifying the server to store the value on or retrieve it from. Instead of hashing on the actual key for the item, we hash on the server key when deciding which memcached server to talk to. This allows related items to be grouped together on a single server for efficiency with multi operations.
Normally, the memcached server is chosen based on the key you're storing (e.g. Memcached::add("key", "value")
chooses which server to use based on "key"
). By specifying a server key, you can change which server is chosen.
So it's something you provide if you want to group values by some means other than the key you're storing or looking up.
Answered By - user94559 Answer Checked By - Senaida (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.