Jdesk / memcached

Automatically exported from code.google.com/p/memcached
0 stars 0 forks source link

delete() unexpected behavior (bug?) #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

<?php
$memcache = new Memcached;
$memcache->addServer('127.0.0.1',11211);
$k = 'membugtest';
$memcache->delete($k);
$memcache->add($k,'string');
var_dump($memcache->get($k));
$memcache->delete($k,3600);
var_dump($memcache->get($k));

What is the expected output? What do you see instead?
First time the output is:
   string(6) "string"
   bool(false)
Next times:
   bool(false)
   bool(false)
Excepted output is the following at any time:
   string(6) "string"
   string(6) "string"

What version of the product are you using? On what operating system?
Memcached 1.2.6 under FreeBSD.

Original issue reported on code.google.com by kak.serp...@gmail.com on 25 Mar 2009 at 5:11

GoogleCodeExporter commented 9 years ago
You're deleting with reservation so your add is failing.  This functionality 
has been
removed in newer versions of memcached, but it was designed specifically to 
provide
this functionality.

You should be checking the results of your ops.  You would see the adds failing 
here.

Original comment by dsalli...@gmail.com on 25 Mar 2009 at 5:50

GoogleCodeExporter commented 9 years ago
> You're deleting with reservation so your add is failing.
1. First operation is $memcache->delete($k); it has no delay.
2. I thought, delete(k,n) sets expiration time to time()+n.

Thanks.

Original comment by kak.serp...@gmail.com on 25 Mar 2009 at 7:20

GoogleCodeExporter commented 9 years ago
Check the return of that delete.  It probably returned NOT_FOUND.

No, the delete with timeout was specifically to ``lock'' a key from adds.  Its
semantics were confusing with flush_all's delay.  Unfortunately flush_all won 
and the
delete with timeout got removed.

Original comment by dsalli...@gmail.com on 25 Mar 2009 at 8:08

GoogleCodeExporter commented 9 years ago
Thank for you very much.
Is it possible to change Time-To-Life of the existing object?

Original comment by kak.serp...@gmail.com on 25 Mar 2009 at 8:54