本文内容为 http://redis.io/commands/decrby 的翻译、注解、例子扩充及其它修改。感谢 Redis 作者 Antirez 为开源社区作出的贡献,本文保证最新、最准、最全以表示对其的敬意。欢迎留言纠错、提示更新或支持。
DECRBY key decrement

将键 key 对应的值减去 decrement

Decrements the number stored at key by decrement.

如果键 key 不存在,则在进行该操作前创建该键并设值为 0

如果键 key 对应的值的类型错误,或虽然是字符串,但该字符串不能用来表示一个整数,将会返回一个错误。

该命令所能操作的数值范围被限制为 64 位有符号整数(64 bit signed integers)

If the key does not exist, it is set to 0 before performing the operation. An error is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64 bit signed integers.

更多信息请查看 INCR 命令中关于递增/递减(Increment/Decrement)操作的介绍。