Back to Redis

GET

content/commands/get.md

latest1.5 KB
Original Source

Get the value of key. If the key does not exist the special value nil is returned. An error is returned if the value stored at key is not a string, because GET only handles string values.

Examples

{{% redis-cli %}} GET nonexisting SET mykey "Hello" GET mykey {{% /redis-cli %}}

Code examples

{{< clients-example set="set_and_get" step="get" description="Foundational: Retrieve the string value of a key using GET (returns nil if key doesn't exist)" difficulty="beginner" />}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |

Return information

{{< multitabs id="get-return-info" tab1="RESP2" tab2="RESP3" >}}

One of the following:

-tab-sep-

One of the following:

{{< /multitabs >}}