CakeFest 2024: The Official CakePHP Conference

Memcached::addByKey

(PECL memcached >= 0.1.0)

Memcached::addByKeyAdd an item under a new key on a specific server

Descrizione

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

Memcached::addByKey() is functionally equivalent to Memcached::add(), 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.

Elenco dei parametri

server_key

La chiave che identifica il server su cui salvare il valore. Invece di effettuare li'hashing sulla chiave dell'elemento, si effettua l'hashing della chiave del server al momento di decidere con quale server memcached comunicare. Questo permette di raggruppare gli elementi correlati ad un singolo server ottenendo maggiore efficienza nelle operazioni multiple.

key

La chiave in cui salvare il valore.

value

Il valore da salvare.

expiration

La data di scadenza, il default è 0. Vedere Date di scadenza per ulteriori informazioni.

Valori restituiti

Restituisce true in caso di successo, false in caso di fallimento. The Memcached::getResultCode() will return Memcached::RES_NOTSTORED if the key already exists.

Vedere anche:

add a note

User Contributed Notes

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