You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking over the redis docs and saw that since redis 2.6.12, it has been possible to SET with both an existence condition (if-not-exists or only-if-exists) and and expiry time (with millisecond resolution). Would this not allow the implementation of setIfNotExists to be made atomic?
The text was updated successfully, but these errors were encountered:
Yes to using SET (with the NX option) instead of SETNX (which the docs warn may be deprecated one day). However, the real optimization would be to also use the EX option of SET instead of the expire() command. This would allow this implementation to be changed so that it makes only one call to the connector (hence atomic). The connector method would need a new parameter for the expire duration.
[Edit]
As a side note, since 2.6.12, all usages of SETNX, SETPX, SETEX can be streamlined by using SET with the new options discussed here.
I was looking over the redis docs and saw that since redis 2.6.12, it has been possible to SET with both an existence condition (if-not-exists or only-if-exists) and and expiry time (with millisecond resolution). Would this not allow the implementation of setIfNotExists to be made atomic?
The text was updated successfully, but these errors were encountered: