Redis Cache icon

Redis Cache

Read and write JSON values in Redis

Redis Cache

AI-generated

Summary

Write or read JSON values in Redis with optional TTL and field-based input composition.

Inputs

  • Mode (required) — Select 'write' to store data or 'read' to fetch data.
  • Key (required) — Redis key under which the JSON is stored or retrieved.
  • Payload Type — Applies only in write mode; choose 'fields' to build JSON from individual fields or 'yamlJson' to provide a raw YAML/JSON string.
  • Data (YAML/JSON) — Applies when Mode=write and Payload Type=yamlJson; a YAML or JSON string that will be parsed and stored.
  • Fields — Applies when Mode=write and Payload Type=fields; a collection of field definitions (key, type, value) that are combined into a JSON object for storage.
  • TTL Unit — Applies in write mode; selects seconds, minutes, hours, or days for the TTL value.
  • TTL Value — Applies in write mode; numeric TTL (0 means no expiration).
  • Include Other Input Fields — When true, the original input item is merged into the output with the operation result placed under a 'result' field.

Output shape

Per input item, returns an object containing either a write or read result. If 'Include Other Input Fields' is false, the result replaces the item; if true, it is nested under a 'result' key while preserving the original item's data.

Write mode result: { ok: true, key: , ttlSeconds: , data: } where data is the parsed value that was stored. Read mode result: { found: , key: , data: } where data is the parsed JSON when found, otherwise undefined.

Examples

Example 1: Cache a user profile

Mode=write, Key='cache:user:123', Payload Type=fields, Fields=[{Key:'name', Type:'string', Value String:'Ada'}, {Key:'age', Type:'number', Value Number:30}], TTL Value=1, TTL Unit=hours

Example 2: Retrieve a cached configuration

Mode=read, Key='cache:config:app', Include Other Input Fields=true

Discussion