Add Support for Hash Field Expiration Commands (HEXPIRE, HEXPIREAT, HGETEX, HPERSIST)

Abierto
#3,230 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
cpp
Área
databases

Línea de trabajo

Comienza con las especificaciones de HEXPIRE, HEXPIREAT, HGETEX y HPERSIST enlazadas en el issue; después, localiza los puntos de entrada existentes de los comandos de hash en Kvrocks y el comportamiento relacionado con la expiración. Se considera terminado cuando los cuatro comandos implementen el comportamiento compatible con Valkey documentado y tengan cobertura para establecer, leer y eliminar la expiración de campos de hash.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

English / 中文

Add Support for Hash Field Expiration Commands (HEXPIRE, HEXPIREAT, HGETEX, HPERSIST)

Introduction

Valkey 9.0 has introduced new commands for setting expiration times on individual hash fields: HEXPIRE, HEXPIREAT, HGETEX, and HPERSIST. These commands allow developers to set expiration times for individual fields independently, enabling finer-grained and more flexible cache control. This enhancement is particularly beneficial for user sessions, temporary data, or cache segmentation scenarios.

According to the Valkey 9.0 release announcement (https://www.linuxmi.com/valkey-9-0.html), these new commands break previous limitations and provide more granular control over hash field expiration.

Proposal

I propose that Kvrocks should also implement these new commands to enhance its compatibility with Redis/Valkey and provide users with more advanced caching capabilities:

  1. HEXPIRE - Set expiration time for a hash field with a TTL in seconds
    https://redis.io/docs/latest/commands/hexpire/

  2. HEXPIREAT - Set expiration time for a hash field with an absolute Unix timestamp
    https://redis.io/docs/latest/commands/hexpireat/

  3. HGETEX - Get the value of a hash field and set its expiration time
    https://redis.io/docs/latest/commands/hexpireat/

  4. HPERSIST - Remove expiration time from a hash field## About Valkey
    https://redis.io/docs/latest/commands/hpersist/

Valkey is a drop-in replacement for Redis that maintains full compatibility while being developed under a truly open-source license (BSD). Major cloud providers including Alibaba, Huawei, Tencent, Amazon, Google, and Ericsson have joined the Valkey initiative.

As noted in industry reports (https://mp.weixin.qq.com/s/6JY3Sl2pLBCLT6Ry1lPdHA), Valkey currently has 6 core maintainers from leading technology companies, ensuring robust community support and ongoing development.

Furthermore, Arch Linux has officially deprecated Redis in favor of Valkey (https://mp.weixin.qq.com/s/yOBjPk1Gqsp2ljQB-3T0nA), highlighting the growing adoption of Valkey as the preferred Redis alternative.

The primary reason for this shift is that Redis changed its license from BSD-3-Clause to RSALv2 and SSPLv1 on March 20, 2024, which many consider to no longer qualify as open-source software. Valkey, as a fork of Redis under the BSD license, represents a community-driven alternative promoted by major companies including Amazon, Google, and Oracle.

Implementing these new hash expiration commands would position Kvrocks as a more complete Redis/Valkey-compatible solution, aligning with the direction of the broader open-source community.

添加对哈希字段过期命令的支持 (HEXPIRE、HEXPIREAT、HGETEX、HPERSIST)

简介

Valkey 9.0 引入了新的命令来为单个哈希字段设置过期时间:HEXPIRE、HEXPIREAT、HGETEX 和 HPERSIST。这些命令允许开发人员独立地为各个字段设置过期时间,从而实现更精细和灵活的缓存控制。对于用户会话、临时数据或缓存细分等场景来说,这一增强功能尤其有益。

根据 Valkey 9.0 发布公告 (https://www.linuxmi.com/valkey-9-0.html),这些新命令打破了之前的限制,提供了对哈希字段过期更精细的控制。

建议

建议 Kvrocks 也实现这些新命令,以增强其与 Redis/Valkey 的兼容性,并为用户提供更高级的缓存功能:

  1. HEXPIRE - 使用以秒为单位的 TTL 为哈希字段设置过期时间
  2. HEXPIREAT - 使用绝对 Unix 时间戳为哈希字段设置过期时间
  3. HGETEX - 获取哈希字段的值并设置其过期时间
  4. HPERSIST - 移除哈希字段的过期时间

关于 Valkey

Valkey 是 Redis 的直接替代品,在保持完全兼容的同时采用真正的开源许可(BSD)进行开发。包括阿里、华为、腾讯、亚马逊、谷歌和爱立信在内的主要云提供商已加入 Valkey 倡议。

正如行业报告中所述 (https://mp.weixin.qq.com/s/6JY3Sl2pLBCLT6Ry1lPdHA),Valkey 目前有 6 位来自领先技术公司的核心维护者,确保了强大的社区支持和持续的开发。

此外,Arch Linux 已正式弃用 Redis 转而支持 Valkey (https://mp.weixin.qq.com/s/yOBjPk1Gqsp2ljQB-3T0nA),这突显了 Valkey 作为首选 Redis 替代品日益增长的采用率。

这种转变的主要原因是 Redis 在 2024 年 3 月 20 日将其许可证从 BSD-3-Clause 更改为 RSALv2 和 SSPLv1,许多人认为这不再符合开源软件的资格。Valkey 作为 BSD 许可证下的 Redis 分支,代表了由亚马逊、谷歌和甲骨文等大公司推动的社区驱动替代方案。

实现这些新的哈希过期命令将使 Kvrocks 成为更完整的 Redis/Valkey 兼容解决方案,与更广泛的开源社区发展方向保持一致。

Lenguaje dominante
C++
Estrellas
4.5k
Forks
689
Merge medio
1 d 22 h
PR fusionados (30 d)
37

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/kvrocks

Todos los issues de apache/kvrocks

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.