On Wed, Nov 12, 2008 at 10:52:12 +1030, Admin wrote:
> Can anyone else repeat this failure, and/or provide info as to
> a) why this happens and how to prevent it
> or
> b) why what we are doing is stupid and suggest a more appropriate test
> while (not $memcached->add($key, $value, 1)) {
> if ($attempt_add++ == $op_attempts) {
You set expiration time to one second. Since memcached has the timer
of 1 second granularity, it happens so that you add an item at the
edge of a second, and it expires immediately. The solution is to not
set the expiration time ;).
--
Tomash Brechko