写入 Redis 哈希
在以下示例中,数据是从名为invoice
并作为哈希键写入 Redis 数据库。这connection
是一个可选参数,它引用config.yaml
.
当您指定data_type
参数,它会覆盖系统范围的设置target_data_type
定义于config.yaml
.
在这种情况下,结果将是具有基于键表达式的键名称的 Redis 哈希(例如invoice_id:1
) 的 Intent Package,有效期为 100 秒。
如果您不提供expire
参数,则密钥永远不会过期。
source:
server_name: chinook
schema: public
table: invoice
output:
- uses: redis.write
with:
connection: target
data_type: hash
key:
expression: concat(['invoice_id:', InvoiceId])
language: jmespath
expire: 100