ListPop icon
ListPush icon

Add a list of strings to Redis

Push and pop string values on a Redis list with Kestra. Clear stale entries, then repopulate the list idempotently using declarative YAML tasks.

Categories
Data
id: redis-list
namespace: company.team

variables:
  key: favorite_plugins

tasks:
  - id: clear_list
    type: io.kestra.plugin.redis.list.ListPop
    url: redis://host.docker.internal:6379/0
    key: "{{ vars.key }}"
    maxRecords: 1

  - id: publish_list
    type: io.kestra.plugin.redis.list.ListPush
    url: redis://host.docker.internal:6379/0
    key: "{{ vars.key }}"
    from:
      - redis
      - duckdb
      - gcp
      - aws

This blueprint shows how to manage a Redis list from a Kestra workflow by clearing it and then repopulating it with a known set of string values. It solves a common problem with append style writes: because ListPush always appends, re-running a flow against an existing list produces duplicate entries. By popping the list first and pushing afterward, you get an idempotent, repeatable result every time the flow runs. It is a clean pattern for seeding queues, refreshing reference lists, and managing ordered collections in Redis without hand written client code.

How it works

  1. The clear_list task (io.kestra.plugin.redis.list.ListPop) removes existing entries from the list stored at the key variable (favorite_plugins), using maxRecords: 1 to pop from the head of the list.
  2. The publish_list task (io.kestra.plugin.redis.list.ListPush) appends a fresh set of string values (redis, duckdb, gcp, aws) to the same key with its from property.
  3. Both tasks connect to Redis through the url property (redis://host.docker.internal:6379/0), and the list key is parameterized through the flow level vars.key variable so it is easy to change in one place.

What you get

  • An idempotent way to reset and repopulate a Redis list.
  • A worked example of the ListPop and ListPush tasks together.
  • A parameterized list key that is reused by every task.
  • A ready to run flow you can test against a local Redis container.

Who it's for

  • Data engineers seeding or refreshing queues and reference lists in Redis.
  • Platform teams standardizing how ordered collections are written.
  • Developers learning the Kestra Redis plugin.

Why orchestrate this with Kestra

Redis itself has no scheduler or workflow engine: it stores data but does not decide when or in what order list operations run. Kestra fills that gap. You can attach event triggers or schedules, enforce ordering so the pop always precedes the push, add retries for transient connection failures, and capture execution lineage and logs for every run. The declarative YAML keeps the whole pipeline in version control instead of scattered scripts.

Prerequisites

  • A running Redis instance reachable at the configured url.

Secrets

This flow uses no secrets. It connects with a plain url and is intended for local testing. For production, move the connection string to a secret such as {{ secret('REDIS_URL') }}.

Quick start

  1. Start Redis locally: docker run --name myredis -p 6379:6379 -d redis.
  2. Add the flow to your Kestra instance.
  3. Execute it and confirm the list contains the four pushed values.

How to extend

  • Change the vars.key value to target a different list.
  • Replace the static from values with outputs from an upstream task.
  • Increase maxRecords to drain longer lists before repopulating.
  • Add a Schedule or event trigger to refresh the list automatically.

Links

Orchestrate with Kestra
Orchestrate Redis with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.