jjz921024 opened a new pull request, #2402:
URL: https://github.com/apache/kvrocks/pull/2402
This pr want to close #2269
1. Encoding
To implement hash expiration by field level, we encode the expiration time
into the first 8 bytes of value.
For example:
```
+-------------------------+
key|version|field => | expire (8 byte) | value |
+-------------------------+
```
And we use the second bit of the flags in metadata to indicate whether
encode the expiration into value.
If all the fields in the hash have no encode expiration time, the
`flags` will be `1 0 0 0 | 0 0 1 0`.
If any field in the hash is encoded into the expiration time, the
`flags` will be `1 1 0 0 | 0 0 1 0`.
2. Flags conversion
For the [HEXPIRE](https://redis.io/docs/latest/commands/hexpire/) command,
it will set an expiration on one or more fields.
If we execute hexpire command on a hash key that has not been set to expire,
this will set the secode bit of `flags` and encode expiration for all fields
(fields that not appear in the command will be set to 0)
3. Add command
According to https://redis.io/docs/latest/commands,add a series of related
commands:
- `HEXPIRE` , `HPEXPIRE` , `HEXPIREAT` , `HPEXPIREAT`
- `HEXPIRETIME` , `HPEXPIRETIME` , `HTTL` , `HPTTL`
- `HPERSIST`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]