DECRBY

Redis 開発者教育の申込 Redis 定期点検/技術サポート
Redis Technical Support
Redis エンタープライズサーバー
Redis Enterprise Server

指定した数値(整数)だけ減少

指定した数値だけ減少させます。つまり指定した数値に -1 を掛けて計算します。
既存にない場合は 0 を基準にして指定した数値(負数)を返します。

Example

コマンド>decrby key 10
結果>-10
コマンド>decrby key 20
結果>-30

アニメーションを見る



負数の入力が可能

負数も入力できます。

Example

コマンド>decrby key -10
結果>10
コマンド>decrby key -20
結果>30

アニメーションを見る



エラー

小数点を入力するとエラーになります。

Example

コマンド>set key 10
結果>OK
コマンド>decrby key 2.5
結果>ERR value is not an integer or out of range


構文

DECRBY key decrement(integer)

  • version 1.0.0 から使用できます。
  • 時間計算量は O(1) です。
関連コマンド INCR, DECR, INCRBY, INCRBYFLOAT
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< INCRBY DECRBY INCRBYFLOAT >>

Email 返事がかかってなれば、メールでお知らせします。