Memcache::delete

(PECL memcache >= 0.2.0)

Memcache::delete�ӷ����ɾ��һ��Ԫ��

˵��

Memcache::delete ( string $key [, int $timeout = 0 ] ) : bool

Memcache::delete()����ͨ��keyɾ��һ��Ԫ�ء� �������timeoutָ������Ԫ�ػ���timeout���ʧЧ�� ͬ��Ҳ����ʹ��memcache_delete()�������ͬ�����ܡ�

����

key

Ҫɾ����Ԫ�ص�key��

timeout

ɾ����Ԫ�ص�ִ��ʱ�䡣���ֵΪ0,���Ԫ������ɾ�������ֵΪ30,Ԫ�ػ���30���ڱ�ɾ����

������־

�汾 ˵��
Unknown It's not recommended to use the timeout parameter. The behavior differs between memcached versions, but setting to 0 is safe. Other values for this deprecated feature may cause the memcache delete to fail.

����ֵ

�ɹ�ʱ���� TRUE�� ������ʧ��ʱ���� FALSE��

����

Example #1 Memcache::delete() example

<?php

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

/* 10���key_to_delete��Ӧ��ֵ�ᱻ�ӷ����ɾ�� */
memcache_delete($memcache_obj'key_to_delete'10);

/* OO API */
$memcache_obj = new Memcache;
$memcache_obj->connect('memcache_host'11211);

$memcache_obj->delete('key_to_delete'10);

?>

�μ�