Skip to content

Redis delete ​

Deletes one key from a Redis cache and emits what was stored under it. Use it to invalidate cache entries or to take a value out of the cache once.

Pins ​

PinKindTypesDescription
InputinputanyThe record the Key expression reads.
Deletedoutputtype of the connectionWhat was stored: the JSON deserialized into the connection's type. Viaducta.Plugins.TextPlugin.Types.TextRecord gives the raw stored text (Value) and the key (Name).
NoDatano datasame as inputThe unchanged input, when there was nothing to delete.

Configuration ​

The configuration is shared with Redis read and Redis write; fields marked write only have no effect here.

FieldTypeDefaultDescription
ConnectionStringstring (max 2048)Required. StackExchange.Redis configuration string, e.g. redis1:6379,ssl=true,password=...,defaultDatabase=0.
StorageModedropdown: 0 String, 1 DistributedCache00: plain Redis strings. 1: the IDistributedCache hash format. Must match how the key was written.
InstanceNamestring (max 255)Visible with StorageMode 1. Prefix in front of every key, the RedisCacheOptions.InstanceName of the scripts.
ConnectTimeoutMsinteger (min 1)5000Connect timeout in milliseconds.
SyncTimeoutMsinteger (min 1)5000Timeout of one operation in milliseconds.
CaCertificatecertificate nameCA that signed the server certificate (ssl=true, private CA). Empty: OS trust store.
ClientCertificatecertificate nameClient certificate with private key for mutual TLS.
Keystring (max 1024)Required. The key, usually an expression: session:{data.SessionId}.
ValuetextWrite only.
Ttlinteger (min 0)3600Write only.
SlidingTtlinteger (min 0)0Write only.
Conditiondropdown: 0 Always, 1 Only if missing0Write only.

Behaviour ​

  • Key is evaluated for every record: {data.X} is the input, {meta.X} the metadata, {config.X} the flow configuration. An empty key fails that record.
  • String mode deletes with GETDEL (Redis 6.2 or newer): atomic, two components never get the same value. DistributedCache mode reads, then removes: not atomic.
  • The key is deleted even when nothing is connected to Deleted, or when the value isn't JSON of the Deleted type (that record then fails with the key already gone).
  • 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.
  • A timeout or lost connection fails that record (recoverable error); the next record is tried again.

Notes ​

  • Values are JSON written by ViaJsonSerializer (default options, UTF-8), the serializer the scripts use.
  • Keep the password in an expression setting: "ConnectionString": "=Secrets.RedisConnection".

Example ​

Invalidate a cached customer when it changes:

json
{ "ConnectionString": "=Secrets.RedisConnection", "Key": "customer:{data.CustomerId}" }

Webhook receiver → Json deserializer → Redis delete ─ Deleted / NoData → Http response

Viaducta documentation