
Redis Set
CertifiedWrite a string value to Redis
Redis Set
Write a string value to Redis
Runs SET on the rendered key using the selected serde (STRING or JSON), supports NX/XX guards, TTL options, keep-ttl, and can return the previous value.
type: io.kestra.plugin.redis.string.SetExamples
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
get: true
options:
mustExist: true
keepTtl: true
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
Redis key to set
Rendered before calling SET.
serdeType *Requiredstring
STRINGSTRINGJSONSerialization format
Defaults to STRING; set to JSON to serialize/deserialize structured values.
url *Requiredstring
Redis connection string
value *Requiredobject
Value to store
Rendered then serialized with the chosen serde; STRING expects plain text, JSON accepts object or JSON string.
get booleanstring
falseReturn existing value
Defaults to false; when true, uses SETGET to return the prior value (not supported on Redis 5.x).
options Non-dynamic
{
"mustNotExist": "false",
"mustExist": "false",
"keepTtl": "false"
}Set options
TTL, NX/XX, and keepTtl flags; see Redis documentation.
io.kestra.plugin.redis.string.Set-Options
Expiration date
Absolute timestamp; cannot be combined with expirationDuration when keepTtl is true.
Expiration duration
Relative TTL; cannot be combined with expirationDate when keepTtl is true.
falseKeep existing TTL
Keeps current TTL instead of resetting; cannot be used with expirationDuration or expirationDate.
falseSet only when key exists
Applies XX behavior; do not combine with mustNotExist.
falseSet only when key is absent
Applies NX behavior; do not combine with mustExist.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
Outputs
oldValue string
Previous value
Returned only when get is true.