Back to Redis

MGET

content/commands/mget.md

latest1.3 KB
Original Source

{{< note >}} This command's behavior varies in clustered Redis environments. See the [multi-key operations]({{< relref "/develop/using-commands/multi-key-operations" >}}) page for more information. {{< /note >}}

Returns the values of all specified keys. For every key that does not hold a string value or does not exist, the special value nil is returned. Because of this, the operation never fails.

Examples

{{% redis-cli %}} SET key1 "Hello" SET key2 "World" MGET key1 key2 nonexisting {{% /redis-cli %}}

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="mget-return-info" tab1="RESP2" tab2="RESP3" >}}

Array reply: a list of values at the specified keys.

-tab-sep-

Array reply: a list of values at the specified keys.

{{< /multitabs >}}