Answer the question
In order to leave comments, you need to log in
Why do replace() before set() in Memcache?
Understanding the Memcache library for PHP, I came across an interesting comment : before doing set() of a value that could already exist, you need to do replace() , because ostensibly when working with a cluster of memcached servers, set() can set several values with the same keys (on different nodes, I guess), and then get can return any of these values.
In order to avoid problems, the author suggests using the following code:
$result = $memcache->replace($key, $var); <br>
if( $result == false ) <br>
{ <br>
$result = $memcache->set($key, $var); <br>
} <br>
Answer the question
In order to leave comments, you need to log in
Are you talking about Memcache or Memcache d ? These are different libraries and Memcache really has some kind of glitch with setters. Try memcached.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question