HTTL
语法
HTTL key FIELDS numfields field [field ...]
- 可用版本
- Redis 开源版 7.4.0
- 时间复杂度
- O(N),其中 N 是指定字段的数量
- ACL 类别
-
@read
,@hash
,@fast
,
返回设置了过期时间的哈希键字段的剩余 TTL(生存时间)。这种内省功能允许您检查给定哈希字段将继续作为哈希键一部分的秒数。
另请参阅 HPTTL
命令,该命令以毫秒分辨率返回相同信息。
示例
redis> HTTL no-key FIELDS 3 field1 field2 field3
(nil)
redis> HSET mykey field1 "hello" field2 "world"
(integer) 2
redis> HEXPIRE mykey 300 FIELDS 2 field1 field3
1) (integer) 1
2) (integer) -2
redis> HTTL mykey FIELDS 3 field1 field2 field3
1) (integer) 283
2) (integer) -1
3) (integer) -2