因此,众所周知,xcache 在 CLI 下不起作用,但仍想测试一些与 symfony2 下的 xcache 部分相关的功能。有以下片段
//this is a working snippet
$key = 'likes';
$cache = $this->getXcacheCache();
if ($cache->contains($key)) {
$likes = $cache->fetch($key);
} elseif ($profile = $this->getProfile()) {
$likes = $this->getProfile()->getProperty('likes');
$cache->save($key, $likes, 3600);
}
如果包含特定键并基于此条件运行其他测试,有没有办法对 xcache 进行单元测试?