php8.5
Home/ Manual/ yac / yac/ Yac::flush

Yac::flush

PHP function Edit on GitHub ✎

(PECL yac >= 1.0.0)

Flush the cache

Description

Yac::flush(): bool

Removes all cached values. Because the cache is shared by every process of the same machine, this empties the cache globally; the key prefix given to Yac::__construct does not limit what gets flushed.

Parameters Parameters

Return Values

Returns true.

Examples

Yac::flush example

php
<?php
$yac = new Yac();
$yac->set("foo", "bar");

$other = new Yac("app2_");
$other->set("baz", "qux");

// flush empties the whole cache: entries of every instance,
// regardless of the prefix used when they were stored
$yac->flush();

var_dump($yac->get("foo"));   // bool(false)
var_dump($other->get("baz")); // bool(false)
?>

See Also

  • Yac::delete
  • Yac::info

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