sybn sybn-util 项目说明文档 - 基于java的跨数据库联合查询

redis_string 字符串表

2026-09-23
sybn

redis_string 是 redis 五种虚拟表之一, 对应 redis 的 string 数据结构, 用于读写单个 key-value.

等效 DQL

  • 虚拟表 SQL
select * from redis_string where key = 'k1'
select * from redis_string where key in ('k1', 'k2')
  • 等效 redis 原生命令
GET k1
MGET k1 k2

返回字段

字段 类型 说明
key string redis key
value string key 对应的值, key 不存在时为 null

可查指标

指标 获取方式 说明
value where key = 'k' 字符串值
type redis_scan 恒为 string
ttl redis_scan -1 永久, -2 不存在, 正数为剩余秒数
exists key 命中即存在 是否存在该 key

查询示例

-- 查单个
select * from redis_string where key = 'user:1'

-- 批量查
select * from redis_string where key in ('user:1', 'user:2')

-- 只取值(投影)
select value from redis_string where key = 'user:1'

限制

  1. 必须带 where 条件, 且只支持 key = 与 key in, 不支持 and 组合.
  2. 不支持 group by / order by / limit(请在外层 SQL 中完成).
  3. key 在 redis 中不是 string 类型时返回”数据类型错误”, 请改用对应的虚拟表.

相关文档: redis-dao / dynamicSourceWrite


Similar Posts

Comments

暂不开放评论! 可微信联系