Implement cache.add with SETNX so cache.add can be atomic like it's expected
The way it is now, doing a cache.add has a slight race condition between checking if the key exists already before setting. This rewrite uses the native SETNX command to only set the key if one doesn't exist yet.
Showing
Please
register
or
sign in
to comment