The problem/use-case that the feature addresses
data in redis for a certain key should only be pushed when there is no data present in it
Description of the feature
Currently there is no such implementation in redis which address the situation when user just wants to push data when no value is present for a certain key. This will allow users to push data only when the key the is not present / data is empty for it. This will be very useful for those scenario when a user may write data in a key through multiple instances in batches and wants data to be written only if first batch founds that key is absent/is empty.
Alternatives you've considered
Tried checking key is present then starting write but in concurrency this fails as some other instance might start pushing data in key after key check is done in this instance making wrong writing being made in key.
Additional information
A must needed feature for distributed systems where multiple instances might push data in same key.
Comment From: oranagra
Did you consider a Lua script? i.e. EVAL or FCALL? it seems like the right approach for such a use case.
Comment From: ukmastercom
The data structure in which i am talking about to store values is List type. I don't think EVAL or FCALL will fit the use-case.
Comment From: oranagra
why not? you can create a push_if_empty function..