Appearance
Redis read
Reads one key from a Redis cache and emits the stored value. Use it for cache lookups, also on keys that C# scripts write with StackExchange.Redis or IDistributedCache.
Pins
| Pin | Kind | Types | Description |
|---|---|---|---|
| Input | input | any | The record the Key expression reads. |
| Found | output | type of the connection | The stored value: the JSON deserialized into the connection's type. Viaducta.Plugins.TextPlugin.Types.TextRecord gives the raw stored text (Value) and the key (Name). |
| NotFound | no data | same as input | The unchanged input, when the key doesn't exist or has expired. |
Configuration
The configuration is shared with Redis write and Redis delete; fields marked write only have no effect here.
| Field | Type | Default | Description |
|---|---|---|---|
ConnectionString | string (max 2048) | Required. StackExchange.Redis configuration string, e.g. redis1:6379,ssl=true,password=...,defaultDatabase=0. | |
StorageMode | dropdown: 0 String, 1 DistributedCache | 0 | 0: plain Redis strings (GET). 1: the IDistributedCache hash format. Must match how the key was written. |
InstanceName | string (max 255) | Visible with StorageMode 1. Prefix in front of every key, the RedisCacheOptions.InstanceName of the scripts. | |
ConnectTimeoutMs | integer (min 1) | 5000 | Connect timeout in milliseconds. |
SyncTimeoutMs | integer (min 1) | 5000 | Timeout of one operation in milliseconds. |
CaCertificate | certificate name | CA that signed the server certificate (ssl=true, private CA). Empty: OS trust store. | |
ClientCertificate | certificate name | Client certificate with private key for mutual TLS. | |
Key | string (max 1024) | Required. The key, usually an expression: order:{config.Env}:{data.CustomerId}. | |
Value | text | Write only. | |
Ttl | integer (min 0) | 3600 | Write only. |
SlidingTtl | integer (min 0) | 0 | Write only. |
Condition | dropdown: 0 Always, 1 Only if missing | 0 | Write only. |
Behaviour
Keyis evaluated for every record:{data.X}is the input,{meta.X}the metadata,{config.X}the flow configuration. An empty key fails that record.- The connection is opened at flow start and shared by all Redis components on the Host with the same connection string, timeouts and certificates. A wrong connection string, a missing certificate or an unreachable server stops the flow at start. Later connection losses are reconnected automatically and logged as warnings.
- In DistributedCache mode a read also refreshes the sliding expiration, as
IDistributedCache.GetAsyncdoes. - Nothing connected to
Found: a found value is not emitted. - A value that isn't JSON of the
Foundtype, a timeout or a lost connection fails that record (recoverable error); the next record is tried again.
Notes
- The two storage modes don't read each other's keys: a plain
GETon anIDistributedCacheentry fails. Values written by other systems that aren't JSON: connectFoundasTextRecord. - Values are JSON written by
ViaJsonSerializer(default options, UTF-8), the serializer the scripts use, so both sides read each other's values. - Keep the password in an expression setting:
"ConnectionString": "=Secrets.RedisConnection".
Example
Cache-aside: read the cache, load and store on a miss. Both branches continue with the same type.
json
{ "ConnectionString": "=Secrets.RedisConnection", "Key": "customer:{data.CustomerId}" }Input → Redis read ─ Found ─────────────────────────────────────────→ continue
└──── NotFound → Http client → Json deserializer → Redis write ─ Written → continueRedis write uses the same Key and an empty Value, so it stores the loaded record and passes it on.