写入 Redis 字符串

string 数据类型可用于从 源表。

在下面的示例作业中,title列从invoice表。 这title然后,将作为 形式AlbumTitle:42,其中42是表的主键值(albumid列)。

connection是一个可选参数,它引用config.yaml. 当您指定data_type参数,它会覆盖系统范围的设置target_data_type定义于config.yaml.在这里,string数据类型还需要args款 替换为value参数,该参数指定要从源表中捕获的列。

可选的expireparameter 设置新 key 将 persist for (此处为 86400 秒,等于 1 天)。 在此时间之后,密钥将自动删除。 如果您不提供expire参数,则密钥永远不会过期。

source:
  server_name: chinook
  table: album
  row_format: full
output:
  - uses: redis.write
    with:
      connection: target
      data_type: string
      key:
        expression: concat(['AlbumTitle:', values(key)[0]])
        language: jmespath
      args:
        value: title
      expire: 86400
RATE THIS PAGE
Back to top ↑