Search code examples
memcachedmqiron.io

Atomic updates to IronCache


I saw that you can atomically increment a value in IronCache, but what if you have many IronWorkers trying to put a value into a single cache key? Would it be better to put those value updates on a Message Queue in order to synchronize updates to the cache or is there another idiomatic way?


Solution

  • There is currently no idiomatic way to update a non-integer Cache item without provoking the race condition gods. There are a lot of different hacks to get around the limitation, but your MQ solution (assuming only one worker is writing the changes) is probably your best bet.

    We are aware of the shortcoming, and we're working on a fix, but we have nothing to announce at this time.