Method
Cache::clear
Remove everything from the cache of every worker.
Description#
public Cache::clear(): boolReturn values#
bool
Errors / Exceptions#
| Exception | When |
|---|---|
LogicException | Directly in swerve.php, which the worker serves after: a coroutine started there waits instead |
Examples#
use Swerve\Swerve;
phasync::run(function () {
$cache = Swerve::cache();
$cache->setMultiple(['a' => 1, 'b' => 2]);
$cache->clear(); // everything, in every worker
var_export($cache->getMultiple(['a', 'b']));
echo "\n";
});Output
array ( 'a' => NULL, 'b' => NULL, )