php8.5
Home/ Manual/ memcached / memcached/ Memcached::replace

Memcached::replace

PHP function Edit on GitHub ✎

(PECL memcached >= 0.1.0)

Replace the item under an existing key

Description

Memcached::replace(string $key, mixed $value, int $expiration = 0): bool

Memcached::replace() is similar to Memcached::set, but the operation fails if the key does not exist on the server.

Parameters

key

Key

value

Value

expiration

Expiration

Return Values

Success The Memcached::getResultCode will return Memcached::RES_NOTSTORED if the key does not exist.

See Also

  • Memcached::replaceByKey
  • Memcached::set
  • Memcached::add

Source: reference/memcached/memcached/replace.xml · from the official PHP manual (php/doc-en)