我正在使用memcache来存储Zend_Config(和其他值) - 我设置的值如下:
$memcache = new Memcache();
...
if (!$config = $memcache->get($memcache->unique_key.APPLICATION_DOMAIN."#config"))
{
...
$memcache->set($memcache->unique_key.APPLICATION_DOMAIN."#config", $config);
}
Run Code Online (Sandbox Code Playgroud)
我正在删除如下值:
$memcache->delete($key);
Run Code Online (Sandbox Code Playgroud)
从memcache中删除值后,它正确地显示在与删除相同的连接中 - $memcache->get($key)正确调用给了我NULL.但是,当我刷新脚本(并与memcache建立新连接)时,数据会弹回,就好像memcache状态没有更新一样.我尝试使用replace(具有一些特定值),达到相同的效果 - 值不会更新.
调用$memcache->flush()工作,并从memcache中删除所有内容,但我想删除特定的键.
在手册页上有一个5年前的一个神秘的消息,关于PECL版本和memcached之间的不兼容性(但是从5年前开始).有人可以向我解释可能会发生什么吗?
我在PHP 5.6上使用memcached 1.4.21和memcache(PECL)3.0.8
问题源于使用此:
$list = array();
$allSlabs = $memcache->getExtendedStats('slabs');
foreach ($allSlabs as $server => $slabs)
foreach ($slabs as $slabId => $slabMeta)
foreach ($memcache->getExtendedStats('cachedump', (int) $slabId) as $entries)
if (!empty($entries))
foreach ($entries as $key => $entry)
if (strpos($key, $memcache->unique_key) === 0)
{
$value = $memcache->get($key);
$list[$key] = is_string($value) && unserialize($value) ? unserialize($value) : $value;
}
Run Code Online (Sandbox Code Playgroud)
(你会注意到它没有包含在我的原始查询中,因为它没有做任何事情,但是列出了存储在memcached中的键/值)
这个功能的问题在于它显然是静默地导致memcached成为只读的.虽然更新函数的后续调用所提供的值(因为,我认为它们是从本地内存中检索的),但memcached服务中的值不是.
此行为会影响当前最新版本的memcached - 在memcache(2.2.x)中引入了中断行为
如果有人想调查这种行为,我会保持开放
| 归档时间: |
|
| 查看次数: |
711 次 |
| 最近记录: |