Dutch PHP Conference 2025 - Call For Papers

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.

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

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top