写入Redis哈希
在以下示例中,数据从名为invoice
的源表中捕获,并作为哈希键写入Redis数据库。connection
是一个可选参数,指的是在config.yaml
中定义的相应连接名称。
当您为作业指定data_type
参数时,它会覆盖在config.yaml
中定义的系统范围设置target_data_type
。
在这种情况下,结果将是基于键表达式(例如invoice_id:1
)的Redis哈希,并且具有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