[英]Cache not working
我具有以下功能,但未缓存。 有什么我想念的吗? 环境:Doctrine Common和DBAL,PHP,MySQL。 缓存ID是否应为变量?
function getGeo($latitude, $longitude, $radius, $numResults, $volunteerPid, $startPosition, $pageSize)
{
$cacheDriver = new Doctrine\Common\Cache\ArrayCache();
$geoQuery = $cacheDriver->fetch($volunteerPid);
if ($geoQuery === false) {
$geoQuery = $this->connection->prepare("call sproc_qryGeo($latitude, $longitude, $radius, $numResults, $volunteerPid, $startPosition, $pageSize)");
$cacheDriver->save($volunteerPid, $geoQuery);
echo "NOT CACHED";
}
return $geoQuery;
}
正如来自缓存类型的定义一样,Doctrine站点上的 ArrayCache
具有请求的生存期。 因此,在您重新加载页面之后,您的缓存就消失了 。
因此,如果您是这种情况,请考虑其他缓存存储,Doctrine支持其中的一堆。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.