Redis Set

Redis Set

Certified

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.

yaml
type: io.kestra.plugin.redis.string.Set

Set a string value.

yaml
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.

yaml
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

Redis key to set

Rendered before calling SET.

DefaultSTRING
Possible Values
STRINGJSON

Serialization format

Defaults to STRING; set to JSON to serialize/deserialize structured values.

Redis connection string

Value to store

Rendered then serialized with the chosen serde; STRING expects plain text, JSON accepts object or JSON string.

Defaultfalse

Return existing value

Defaults to false; when true, uses SETGET to return the prior value (not supported on Redis 5.x).

Default{ "mustNotExist": "false", "mustExist": "false", "keepTtl": "false" }

Set options

TTL, NX/XX, and keepTtl flags; see Redis documentation.

Definitions
expirationDatestring

Expiration date

Absolute timestamp; cannot be combined with expirationDuration when keepTtl is true.

expirationDurationstring

Expiration duration

Relative TTL; cannot be combined with expirationDate when keepTtl is true.

keepTtlbooleanstring
Defaultfalse

Keep existing TTL

Keeps current TTL instead of resetting; cannot be used with expirationDuration or expirationDate.

mustExistbooleanstring
Defaultfalse

Set only when key exists

Applies XX behavior; do not combine with mustNotExist.

mustNotExistbooleanstring
Defaultfalse

Set only when key is absent

Applies NX behavior; do not combine with mustExist.

Reference (ref) of the pluginDefaults to apply to this task.

Previous value

Returned only when get is true.