我在当前项目中使用 Zend Cache 并且工作正常。
但我希望它工作得更快,所以我想在使用 zend 缓存的加载功能之前检查缓存是否存在。
以下是我的代码:
$cache = Zend_Registry::get('cache');
if(!$result = $cache->load('firstfile')) {
$newArray = 'firstfile';
$cache->save($newArray, 'firstfile');
} else {
echo 'retrieving cache data';
Zend_Debug::dump($result);
}
我阅读了zend缓存的文档。它说我们只使用这种方式加载来检查缓存是否存在。我想知道是否还有其他可用的 zend 缓存功能,例如 hasCached 或类似的东西,因此我们可以在使用加载功能之前使用它来检查缓存是否存在。
提前致谢... :)