PHP - Memcache::replace() Function



Memcache::replace() function can replace the value of an existing item.

Syntax

bool Memcache::replace( string $key , mixed $var [, int $flag [, int $expire ]] )

Memcache::replace() function can be used to replace the value of an existing item with key. In case if item with such key doesn't exists, Memcache::replace() function can return false. For the rest, Memcache::replace() function behave identical to Memcache::set() function. We can also use memcache_replace() function.

Memcache::replace() function can return true on success or false on failure.

Example

replace("test_key", "some variable", false, 30);
?>
Advertisements