A
A
Alexey2017-01-16 23:08:17
PHP
Alexey, 2017-01-16 23:08:17

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

1 answer(s)
A
Alexander Aksentiev, 2017-01-16
@dzheka3d

public bool Memcached::set ( string $key , mixed $value [, int $expiration ] )

The flag is in memcache->set
There is no flag in memcached->set.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question