Set a string value for a given Redis key.
Set a string value for a new key or update the current key value with a new one.
type: "io.kestra.plugin.redis.string.Set"
Examples
Set a string value.
id: redis_set
namespace: company.team
inputs:
- id: key_name
type: STRING
displayName: Key Name
- id: key_value
type: STRING
displayName: Key Value
tasks:
- id: set
type: io.kestra.plugin.redis.string.Set
url: redis://:redis@localhost:6379/0
key: "{{ inputs.key_name }}"
value: "{{ inputs.key_value }}"
serdeType: STRING
Set a JSON value.
id: redis_set_json
namespace: company.team
tasks:
- id: set
type: io.kestra.plugin.redis.string.Set
url: "{{ secret('REDIS_URI')}}"
key: "key_json_{{ execution.id }}"
value: |
{{ {
"flow": flow.id,
"namespace": flow.namespace
} | toJson }}
serdeType: JSON
- id: get
type: io.kestra.plugin.redis.string.Get
url: "{{ secret('REDIS_URI')}}"
serdeType: JSON
key: "key_json_{{ execution.id }}"
Properties
key *Requiredstring
The redis key you want to set.
serdeType *Requiredstring
STRING
STRING
JSON
Format of the data contained in Redis.
url *Requiredstring
The connection string.
value *Requiredobject
The value you want to set.
Must be a string for serdeType: STRING
or can be an object or a json string serdeType: JSON
get booleanstring
false
Define if you get the older value in response, does not work with Redis 5.X.
options Non-dynamicSet-Options
{
"mustNotExist": "false",
"mustExist": "false",
"keepTtl": "false"
}
Options available when setting a key in Redis.
See redis documentation.
Outputs
oldValue string
Old value
The old value if you replaced an existing key Required Get to true
Definitions
io.kestra.plugin.redis.string.Set-Options
expirationDate string
date-time
Set the expiration date.
expirationDuration string
duration
Set the expiration duration.
keepTtl booleanstring
false
Retain the time to live associated with the key.
mustExist booleanstring
false
Only set the key if it already exist.
mustNotExist booleanstring
false
Only set the key if it does not already exist.