function checkHallPending($hallId, $hall)
{
global $db;
$memcache = new Memcached;
$memcache->addServer('localhost', 11211) or die ("Could not connect");
$cacheKey = md5("check".$hallId.$hall);
$cacheResult = $memcache->get($cacheKey);
if($cacheResult)
{
return $result = $cacheResult;
}
else
{
$query = $db->prepare("SELECT * FROM " . JP_PENDING . " WHERE Hall = ? AND Id = ?");
$query->bindValue(1, $hall);
$query->bindValue(2, $hallId);
try
{
$query->execute();
$result = $query->rowCount();
$memcache->set($cacheKey, $result, 12000);
return $result;
}
catch(PDOException $e)
{
die($e->getMessage());
}
}
}
Я пытаюсь кэшировать вывод и распечатать, но $ cacheResult возвращает false.
Задача ещё не решена.
Других решений пока нет …