OpenAtomFoundation / pika

Pika is a Redis-Compatible database developed by Qihoo's infrastructure team.
BSD 3-Clause "New" or "Revised" License
5.78k stars 1.19k forks source link

feature: redis hash field timeout #2709

Open AlexStocks opened 1 month ago

AlexStocks commented 1 month ago

Which PikiwiDB functionalities are relevant/related to the feature request?

No response

Description

1 据说 redis 7.4 hash field 支持 timeout

Proposed solution

在 pika 中支持 hash field timeout

Alternatives considered

ehash

AlexStocks commented 1 month ago

todo: xiaodi 负责 1 确定 redis 命令格式; 2 借鉴 https://github.com/XimalayaCloud/xcache 的实现,但是格式按照 redis 接口

xhash 实现:

新增 ehash 数据类型
ehash 是一种可为 field 设置过期时间的 hash 类型数据结构。支持和 redis hash 一样丰富的数据接口,极大地提高了 hash 数据结构的灵活性,简化了很多场景下的业务开发工作。

主要特性:

field 支持单独设置过期时间
field 过期后支持高效删除
使用语法和原生 redis hash 数据类型类似

Redis 新指令

New commands
HEXPIRE
HEXPIREAT
HEXPIRETIME
HPERSIST
HPEXPIRE
HPEXPIREAT
HPEXPIRETIME
HPTTL
HTTL
Issues-translate-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically.


todo: xiaodi is responsible 1 Determine the redis command format:https://github.com/redis/redis/pull/13303; 2 Learn from the implementation of https://github.com/XimalayaCloud/xcache, but the format follows the redis interface

bigdaronlee163 commented 2 days ago

@me 我来尝试做这个feature