Skip to main content

Description

Get the value of key. If the key does not exist, null is returned. An error is returned if the value stored at key is not a string.

Syntax

Parameters

key
string
required
The key to retrieve

Type Parameters

TData
type
default:"string"
The expected type of the returned data. The SDK will attempt to deserialize the value to this type.

Returns

value
TData | null
The value of the key, or null if the key does not exist

Examples

Basic Usage

Working with JSON Data

Using Automatic Deserialization

  • set - Set the string value of a key
  • mget - Get the values of multiple keys

Redis Documentation

For more information, see the Redis GET documentation.