redis-get
Get the value of the given key from a Redis connect profile.
Syntax
redis-get profile=STRING key=STRING
Options
- profile=STRING
- Required. Name of the Redis connect profile. Either a Redis Client (Standalone) or a Redis Client (Sentinel) profile is accepted. Example: profile=my_redis
- key=STRING
- Required. Redis key to GET. Example: key=session:1001
Output fields
| Field | Type | Name | Description |
|---|---|---|---|
| key | String | Key | Redis key |
| value | String | Value | GET reply value. null if the key does not exist |
| _error | String | Error | Error message for command failure. Absent on success |
Error codes
Parse errors
| Error message | Cause | Resolution |
|---|---|---|
| No available Redis profile | No profile with the given name exists, or the current account is not granted access to it. | Check the profile name and grant the account access to the profile. |
| profile option is required | The profile option is missing or empty. | Specify profile=profile_name. |
| key option is required | The key option is missing or empty. | Specify key=key_name. |
Runtime errors
| Error message | Cause | Resolution |
|---|---|---|
| (_error field of the output row) | A Redis error occurred, such as a connection failure, authentication failure, timeout or WRONGTYPE. The query does not abort; one row holding only key and _error is returned. | Check the message in the _error field, the connection settings and the key type. |
Description
Connects to the Redis server of the connect profile, runs GET and outputs the result as one row. It takes no pipe input, so use it at the beginning of a query.
If the key does not exist, a row with a null value is output. Using it on a key of a non-string type outputs a WRONGTYPE error in the _error field. The connection is opened on each execution and closed when it finishes.
Examples
Example: Looking up a session key
Situation: Check the value stored in the session key session:1001.
Expected result:
| key | value |
|---|---|
| session:1001 | user01 |
Interpretation: An empty value means the key does not exist or has expired.