Sometimes i got query errors due to race-conditions; When two (or more) clients call save_cache, they second will fail since the key allready exists.

This problem was attempted to solve by first doing a query if the key exists or not, then decide to either insert or update. This is offcourse not threadsafe...

I tried to fix it with this update by using 'on duplicate key update' so both tasks (query + insert or update) are done by mysql in one go.


More...