My program checks the return value after each operation of redis, but I found that the return value of some commands is 'OK', such as SET, HMSET. and the return value of some commands is number, such as HSET, LPUSH. Can you change all return values to numbers? Redis The return value of the update command is inconsistent

Comment From: oranagra

The return values of each command are documented in https://redis.io/commands/ each command has it's own concerns and reasons for the return types. Obviously your request is only referring to write commands (since read commands return different values depending on the arguments, e.g. SRANDMEMBER can return either one element or an array if COUNT is provided).

Even for write commands, while you suggest that 1 is similar to +OK, but 0 is not the same as -ERR. And note that even the commands that return either 0, or 1 (such as HSET), can still return an error (like -WRONGTYPE).

Can you change all return values to numbers?

in any case, even if we wanted to change things, we obviously can't due to backwards compatibility (such a change will break many existing clients and apps).

Comment From: ffbh123456

Do all versions of redis now require backward compatibility? Is the next big version redis7 also?

Comment From: oranagra

yes. redis is mostly backwards compatible with all previous versions (at least back to 2.4). this is true for both file format and replication protocol compatibility, and also the API for applications (commands). and we don't plan to break this, doing so would cause many applications to break and be force to be re-written.