Is it ever possible that your compute takes longer than your timeout?

On Fri, Oct 15, 2010 at 5:45 AM, Tobias <[email protected]> wrote:

> > Can you give more info about exactly what the app is doing?
>
> Something like this:
>
> value = memcache.get("record" + x)
>
> if (false == value && cache.add("lock" + x, "1", 60)) {
>
>   compute (expensive) record
>   insert record with Primary key x Into DB
>   memcache.set("record" + x, record);
>   memcache.delete("lock" + x);
>
> } else {
>  // someone else is doing the expensive stuff
> }
>
> In a very few cases (<20 of 3 Million) we observed a "Duplicate entry"
> Mysql-Error.
>
>
>
>


-- 
awl

Reply via email to