> 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.



Reply via email to