PHP 8.1.28 Released!

Memcached::casByKey

(PECL memcached >= 0.1.0)

Memcached::casByKeyCompare and swap an item on a specific server

Descrizione

public Memcached::casByKey(
    string|int|float $cas_token,
    string $server_key,
    string $key,
    mixed $value,
    int $expiration = 0
): bool

Memcached::casByKey() is functionally equivalent to Memcached::cas(), 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

cas_token

Unique value associated with the existing item. Generated by memcache.

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_DATA_EXISTS if the item you are trying to store has been modified since you last fetched it.

Vedere anche:

add a note

User Contributed Notes

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