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.

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

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

The redis key you want to set.

Default STRING
Possible Values
STRINGJSON

Format of the data contained in Redis.

The connection string.

The value you want to set.

Must be a string for serdeType: STRING or can be an object or a json string serdeType: JSON

Default false

Define if you get the older value in response, does not work with Redis 5.X.

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

Options available when setting a key in Redis.

Old value

The old value if you replaced an existing key Required Get to true

Format date-time

Set the expiration date.

Format duration

Set the expiration duration.

Default false

Retain the time to live associated with the key.

Default false

Only set the key if it already exist.

Default false

Only set the key if it does not already exist.