php8.5
Home/ Manual/ memcache / memcache/ Memcache::flush

Memcache::flush

PHP function Edit on GitHub ✎

(PECL memcache >= 1.0.0)

Flush all existing items at the server

Description

Memcache::flush(): bool
memcache_flush(Memcache $memcache): bool

Memcache::flush() immediately invalidates all existing items. Memcache::flush() doesn't actually free any resources, it only marks all the items as expired, so occupied memory will be overwritten by new items.

Parameters Parameters

Return Values

Success

Examples

Memcache::flush() example

php
<?php

/* procedural API */
$memcache_obj = memcache_connect('memcache_host', 11211);

memcache_flush($memcache_obj);

/* OO API */

$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host', 11211);

$memcache_obj->flush();

?>

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