略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Memcached::flush

2024-04-27

Memcached::flush

(PECL memcached >= 0.1.0)

Memcached::flush作废缓存中的所有元素

说明

public Memcached::flush(int $delay = 0): bool

Memcached::flush()立即(默认)或者在delay延迟后作废所有缓存中已经存在的元素。 在作废之后检索命令将不会有任何返回(除非在执行Memcached::flush()作废之后,该key下被重新存储过)。flush不会 真正的释放已有元素的内存, 而是逐渐的存入新元素重用那些内存。

参数

delay

在作废所有元素之前等待的时间(单位秒)。

返回值

成功时返回 true, 或者在失败时返回 false。 如需要则使用 Memcached::getResultCode()

范例

示例 #1 Memcached::flush() 示例

<?php
$m 
= new Memcached();
$m->addServer('localhost'11211);

/* 10秒内清除所有元素 */
$m->flush(10);
?>
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/memcached.flush.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3