Deletes Are Driving Me Crazy

Matthew Glubb matt at zgroupplc.com
Wed Jan 11 16:04:04 UTC 2006


Hi Fabian,

If you refer to the thread that I quoted in my original mail it was  
accepted as a bug then and a patch was introduced.

I am afraid that, for legal reasons, I am unable to provide you with  
the specific application of memcache in this instance but I can  
assure you that I understand that memcache is not a database, it is a  
cache ;)

I simply wish to be able to delete a key that has a zero expiry  
period and then immediately be able to add a key of the same name.  
The reason that I cannot use set is because if it already exists in  
the cache I do not want to replace the value.

I have just tried the same process with the PECL extension and the  
problem persists. For this reason I am pretty sure that the problem  
is not with the PHP extensions that I have used.

I should note that this problem seems to be sporadic and time based,  
leading me to believe that keys are not necessarily deleted from  
memcache at the moment the request is made.

Thanks a lot for your help on this one. Perhaps I have missed  
something fundamental about memcache regarding deletes, etc?

Regards,

Matt

On 11 Jan 2006, at 15:03, Fabian Thylmann wrote:

> Could you explain a little bit more what you are trying to do then?  
> Maybe you are using memcached in a way it was not designed to be used.
>
> Fabian
>
>
> Matthew Glubb wrote:
>
>> Thanks for the reply, but no, that is not want I want. I need to  
>> know  that when I delete an item, it is deleted. I need to be able  
>> to use  add because there are other situations where I want to  
>> prevent the  possibility of overwriting a value. 'add' is a great  
>> way to defend  against that situation.
>>
>> Matt
>>
>> On 11 Jan 2006, at 11:39, Fabian Thylmann wrote:
>>
>>> Hi Matt,
>>>
>>> what you probably want is
>>>
>>> set(key, val)
>>>
>>> which will set a new value for key even if it exists.
>>>
>>> Fabian
>>>
>>>
>>> Matthew Glubb wrote:
>>>
>>>> Happy New Year to you all.
>>>>
>>>> I am sorry if this has been covered before but I have trawled   
>>>> through  the list archives and cannot find a definitive solution.
>>>>
>>>> I would really like to know how to:
>>>>
>>>> add(key, val)
>>>> delete(key)
>>>> add(key, val)
>>>>
>>>> Just seems to plain not work (all adds have zero expiration).
>>>>
>>>> If I:
>>>>
>>>> add(key, val)
>>>> delete(key, 1)
>>>> sleep(2)
>>>> add(key, val)
>>>>
>>>> It works.
>>>>
>>>> Please can someone enlighten me as to how I may immediately  
>>>> delete  a  key and then add a key of the same name? I am using   
>>>> memcached-1.1.12  & John McCaskey's mcache extension 1.2.0 beta10.
>>>>
>>>> I noticed in the archives this thread:
>>>>
>>>> <http://lists.danga.com/pipermail/memcached/2004-July/000688.html>
>>>>
>>>> This seems to be related to the problem that I am having but  
>>>> my   version of memcached is almost a year later than this so I  
>>>> would   assume that the patch referred to in the thread is  
>>>> included. I'm   going to check that this isn't a problem with  
>>>> John's mcache  extension  but if anyone has a simple answer to  
>>>> my problem I'd  love to hear it.
>>>>
>>>> Thanks a lot for your help :)
>>>>
>>>> Matt
>>>>
>>>>
>>>
>>
>>
>>
>> m a t t h e w   g l u b b
>>
>> _____________________________________________________________________ 
>> ___
>> Z Group PLC
>>
>> Tel: +44 (0) 8700 111 173
>> Fax: +44 (0) 8707 051 393
>> Txt: +44 (0) 7800 140 877
>> Web: <http://www.zgroupplc.com/>
>>
>> PLEASE NOTE ZGROUP IS NOT LIABLE  FOR ANY DAMAGES,  MALFUNCTION,  
>> OR LOSS
>> OF DATA,  CAUSED AS A RESULT OF FOLLOWING  ANY  ADVICE  ENCLOSED  
>> IN THIS
>> EMAIL. ANY CHANGES SHOULD BE CARRIED OUT AT YOUR OWN RISK.
>>
>> This  email  and  any  files  transmitted  with it are   
>> confidential and
>> intended solely for the use of the individual or entity to whom  
>> they are
>> addressed.  The opinions  expressed in this mail are those of the  
>> author
>> and do not necessarily  represent the views of the company.  If  
>> you have
>> received this email in error please notify <service at zgroupplc.com>
>>
>>
>>
>>
>>
>



m a t t h e w   g l u b b

________________________________________________________________________
Z Group PLC

Tel: +44 (0) 8700 111 173
Fax: +44 (0) 8707 051 393
Txt: +44 (0) 7800 140 877
Web: <http://www.zgroupplc.com/>

PLEASE NOTE ZGROUP IS NOT LIABLE  FOR ANY DAMAGES,  MALFUNCTION, OR LOSS
OF DATA,  CAUSED AS A RESULT OF FOLLOWING  ANY  ADVICE  ENCLOSED IN THIS
EMAIL. ANY CHANGES SHOULD BE CARRIED OUT AT YOUR OWN RISK.

This  email  and  any  files  transmitted  with it are  confidential and
intended solely for the use of the individual or entity to whom they are
addressed.  The opinions  expressed in this mail are those of the author
and do not necessarily  represent the views of the company.  If you have
received this email in error please notify <service at zgroupplc.com>





More information about the memcached mailing list