Redis String: DECR
DECR key
Redis DECR command is used to decrement the integer value of a key by one. If the key does not exist, it is set to 0 before performing the operation. If the key contains a value of the wrong type or contains a string that can not be represented as integer an error is returned.
Syntax:
DECR KEY_NAME
Available since
1.0.0.
Return Value
Integer reply, the value of key after the increment
Return Value Type
Integer
Example: Redis DECR
redis 127.0.0.1:6379> SET visitors 1000 OK redis 127.0.0.1:6379> DECR visitors (integer) 999 redis 127.0.0.1:6379> SET visitors "13131312312312312312312rgergerg" Ok redis 127.0.0.1:6379> DECR visitors ERR value is not an integer or out of range
Previous:
INCRBYFLOAT
Next:
DECRBY
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework