Answer the question
In order to leave comments, you need to log in
Why doesn't memcache return data?
Hello! What am I doing wrong? The program constantly goes inside the if condition and re-pulls the data from the database:
$md5_query = md5($query);
$m = new Memcached;
$m->addServer('localhost', 11211);
$second->set('bikes.php '.__LINE__);
$row = $m->get($md5_query);
if(!$row){
$res = $db->query($query);
$row = $res->fetch_assoc();
debug($row); // массив выводится
$m->set($md5_query, $row, time() + 300);
debug($m->get($md5_query)); // пусто
}
Answer the question
In order to leave comments, you need to log in
public bool Memcached::set ( string $key , mixed $value [, int $expiration ] )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question