This method emits this php warning if OPT_COMPRESSION is not explicitly set to false (tested with libmemcached 1.0.18 & pecl-memcached 2.1.0):
PHP Warning: Memcached::append(): cannot append/prepend with compression turned on
(PECL memcached >= 0.1.0)
Memcached::append — 向已存在元素追加数据
Memcached::append() 向已存在的元素值末尾追加 value
字符串。value
强制为字符串的原因是因为对于 mix 类型的追加没有明确定义。
注意:
如果启用
Memcached::OPT_COMPRESSION
,该操作将会失败并引发警告,因为无法向已压缩的数据追加压缩数据。
key
用于存储值的键名。
value
将要追加的值。
示例 #1 Memcached::append() 示例
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->setOption(Memcached::OPT_COMPRESSION, false);
$m->set('foo', 'abc');
$m->append('foo', 'def');
var_dump($m->get('foo'));
?>
以上示例会输出:
string(6) "abcdef"
This method emits this php warning if OPT_COMPRESSION is not explicitly set to false (tested with libmemcached 1.0.18 & pecl-memcached 2.1.0):
PHP Warning: Memcached::append(): cannot append/prepend with compression turned on