YouTip LogoYouTip

Strings Incr

# Redis Incr Command [!(#) Redis Strings](#) The Redis INCR command increments the numeric value stored at key by one. If the key does not exist, it is first initialized to 0 before performing the INCR operation. If the value has the wrong type or if the string value cannot be represented as a number, an error is returned. The value is limited to the range of a signed 64-bit integer. ### Syntax The basic syntax of the Redis INCR command is as follows: redis 127.0.0.1:6379> INCR KEY_NAME ### Available Versions >= 1.0.0 ### Return Value The value of the key after executing the INCR command. ### Example redis> SET page_view 20 OK redis> INCR page_view (integer) 21 redis> GET page_view # Numeric values are stored as strings in Redis"21" [!(#) Redis Strings](#)
← Strings IncrbyStrings Psetex β†’