CodePudding user response:
Value add a version number of the advice I can give deposit such as timestamp or common value, each time you update the data than the first versionCodePudding user response:
1. Redis is single thread running, so multiple redis command is a an execution, so is thread-safe 2. But separate two redis command, for [used] is not thread-safe, because between the two redis command will have other commands, like Java thread unsafe i++ operation, the two redis commands no transaction management3. You can use RPOPLPUSH INCR or lua scripts, implement multiple redis operation into a command, thus to [applications] thread safe