Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: redis hash field timeout #2709

Open
AlexStocks opened this issue Jun 7, 2024 · 6 comments
Open

feature: redis hash field timeout #2709

AlexStocks opened this issue Jun 7, 2024 · 6 comments
Assignees
Labels
✏️ Feature New feature or request

Comments

@AlexStocks
Copy link
Contributor

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 AlexStocks added the ✏️ Feature New feature or request label Jun 7, 2024
@AlexStocks
Copy link
Contributor Author

AlexStocks commented Jun 7, 2024

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
Copy link

Issues-translate-bot commented Jun 7, 2024

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


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

@bigdaronlee163
Copy link
Contributor

bigdaronlee163 commented Jul 19, 2024

@me 我来尝试做这个feature

@bigdaronlee163
Copy link
Contributor

方案待讨论

  1. xcache重新定义了一个全新的类型用于支持hash field字段过期的功能,并且该类型在xcache中没有利用缓存。
    1. xcache重新定义了一个新的DataValue类型,用于支持field过期的功能。
  2. 在禁用redis cache的前提下, 在pika里面,已经实现了支持field过期的 hexpire 和 hget。
    1. 实例:
  3. 方案待确定:
    1. 破坏兼容性,保留普通hash数据结构的性能的方法:使用全新设计的ehash类型。
    2. 保留兼容性,但是hash不能支持缓存,性能。
      1. 如果让支持field过期的hash支持缓存,这个方案还不知道怎么做。
  4. 是选取那种方案?
  5. 后面的工作量就是适配所有的hash命令。

@Issues-translate-bot
Copy link

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


Plan to be discussed

  1. xcache has redefined a brand new type to support the hash field expiration function, and this type does not utilize caching in xcache.
    1. xcache redefines a new DataValue type to support the field expiration function.
  2. On the premise of disabling redis cache, in pika, hexpire and hget that support field expiration have been implemented.
    1. Example:
  3. Plan to be determined:
    1. Method to destroy compatibility and retain the performance of ordinary hash data structures: use the newly designed ehash type.
    2. Retain compatibility, but hash cannot support caching and performance.
      1. If the hash that supports field expiration supports caching, I don’t know how to do this solution yet.
  4. Which plan should you choose?
  5. The next workload is to adapt all hash commands.

@bigdaronlee163
Copy link
Contributor

The implementation of the basic command is completed, and I am currently writing test cases for each command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants