YouTip LogoYouTip

Strings Getrange

# Redis Getrange Command [!(#) Redis Strings](#) The Redis GETRANGE command retrieves a substring of the string stored at the specified key. The substring is determined by the start and end offsets (inclusive of both start and end). ### Syntax The basic syntax of the Redis GETRANGE command is as follows: redis 127.0.0.1:6379> GETRANGE KEY_NAME start end ### Available versions >= 2.4.0 ### Return value The extracted substring. ### Example First, set the value of mykey and then extract substrings. redis 127.0.0.1:6379> SET mykey "This is my test key" OK redis 127.0.0.1:6379> GETRANGE mykey 0 3"This" redis 127.0.0.1:6379> GETRANGE mykey 0 -1"This is my test key" [!(#) Redis Strings](#)
← Strings GetsetStrings Get β†’