Module接口:
1) /**
* Single-add operations, for example
* $memcache->tag_add('tag1', array('key1', 'key2', 'key3'))
* $memcache->tag_add('tag1', 'key1')
*/
bool tag_add(mixed tag, mixed keys = null)
/**
* Single-delete operations, for example
* $memcache->tag_delete('tag1')
*
* Multi-delete operations, for example
* $memcache->tag_delete(array('tag1', 'tag2'))
*/
bool tag_delete(mixed tag)
example:
$memcache = memcache_connect("127.0.0.1", 11211);
if ($memcache)
{
for ($i=0; $i<10; $i++)
{
$memcache->set("key$i", "val$i");
}
$memcache->tag_add("tag_1", array("key1", "key1", "key1", "key2", "key3", "key1", "key4"));
$memcache->tag_add("tag_2", "key1");
$memcache->tag_add("tag_3", array("key1", "key2", "key3", "key1"));
$memcache->tag_delete("tag_2");
$memcache->tag_delete(array("tag_1“, “tag_3”));
}
else
{
echo "Connection to memcached failed";
}
?>
--------------------next---------------------
阅读(529) | 评论(0) | 转发(0) |