缓存不起作用

时间:2016-01-13 16:26:07

标签: php mysql caching doctrine

我有以下功能,但它不是缓存。有什么我想念的吗?环境:Doctrine Common和DBAL,PHP,MySQL。我不应该将Cache 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;
    }

1 个答案:

答案 0 :(得分:0)

来自cache types definintions on Doctrine site ArrayCache有一生的请求。因此,在您重新加载页面后 - 您的缓存消失

因此,如果这是你的情况 - 想想另一个缓存存储,Doctrine支持其中一堆。