Are there any patterns to deal with concurrency in ElastiCache?
I know transactions aren't supported of course, but are there any operations like upserts or "update-if" that return boolean values indicating if the operation "wins"?
Are there any patterns to deal with concurrency in ElastiCache?
I know transactions aren't supported of course, but are there any operations like upserts or "update-if" that return boolean values indicating if the operation "wins"?
I'd consider a number of commands falling into that category.
BRPOPLPUSH (and non-blocking cousin RPOPLPUSH): take an item from one list and if successful, push the item onto another list and return it. I used this to implement queues for a distributed 'worker' setup. It's explained in the pattern section: http://redis.io/commands/rpoplpush
HSETNX/MSETNX/SETNX: set a hash key or string key to a value if it does not exist already. http://redis.io/commands/setnx