array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'memcached.replacebykey.php', 1 => 'Memcached::replaceByKey', 2 => 'Replace the item under an existing key on a specific server', ), 'up' => array ( 0 => 'class.memcached.php', 1 => 'Memcached', ), 'prev' => array ( 0 => 'memcached.replace.php', 1 => 'Memcached::replace', ), 'next' => array ( 0 => 'memcached.resetserverlist.php', 1 => 'Memcached::resetServerList', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/memcached/memcached/replacebykey.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Memcached::replaceByKey

(PECL memcached >= 0.1.0)

Memcached::replaceByKeyReplace the item under an existing key on a specific server

Опис

public Memcached::replaceByKey(
    string $server_key,
    string $key,
    mixed $value,
    int $expiration = 0
): bool

Memcached::replaceByKey() is functionally equivalent to Memcached::replace(), except that the free-form server_key can be used to map the key to a specific server. This is useful if you need to keep a bunch of related keys on a certain server.

Параметри

server_key

Ключ, що визначає сервер, на якому зберігатиметься значення або з якого його можна отримати. Замість гешування ключа елемента, гешується ключ сервера, з яким буде взаємодіяти memcached. Це дозволяє об'єднувати пов'язані елементи на єдиному сервері для пришвидшення одночасних операцій.

key

Ключ, під яким зберігається значення.

value

Значення для зберігання.

expiration

Термін зберігання, стандарно — 0. Докладніше: Терміни зберігання.

Значення, що повертаються

Повертає true у разі успіху або false в разі помилки. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key does not exist.

Прогляньте також