- Redis Basics
- Redis - Home
- Redis - Overview
- Redis - Environment
- Redis - Configuration
- Redis - Data types
- Redis Commands
- Redis - Commands
- Redis - Keys
- Redis - Strings
- Redis - Hashes
- Redis - Lists
- Redis - Sets
- Redis - Sorted Sets
- Redis - HyperLogLog
- Redis - Publish Subscribe
- Redis - Transactions
- Redis - Scripting
- Redis - Connections
- Redis - Server
- Redis Advanced
- Redis - Backup
- Redis - Security
- Redis - Benchmarks
- Redis - Client Connection
- Redis - Pipelining
- Redis - Partitioning
- Redis - Java
- Redis - Php
- Redis Useful Resources
- Redis - Quick Guide
- Redis - Useful Resources
- Redis - Discussion
Redis - String Decr Command
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. An error is returned, if the key contains a value of the wrong type or contains a string that cannot be represented as an integer. This operation is limited to 64 bit signed integers.
Return Value
Integer reply, the value of the key after the increment.
Syntax
Following is the basic syntax of Redis DECR command.
redis 127.0.0.1:6379> DECR KEY_NAME
Example
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
redis_strings.htm
Advertisements