Skip to content

Commit 157bd13

Browse files
committed
addons(kv): add GETDEL, HEXISTS, HSETNX, HINCRBY, EXPIREAT, PEXPIREAT commands
1 parent cb25fad commit 157bd13

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

.github/styles/config/vocabularies/Doc/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ LLM
6161
LLMs
6262
Lume
6363
LTS
64+
Materia
6465
Matomo
6566
maven
6667
Metabase
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "Materia KV: new commands and improved reliability"
3+
description: Materia KV now supports GETDEL, HEXISTS, HSETNX, HINCRBY, EXPIREAT and PEXPIREAT commands, with improved scan reliability and transaction retry limits.
4+
date: 2026-03-11
5+
tags:
6+
- addons
7+
- materia
8+
- kv
9+
authors:
10+
- name: Baptiste Le Morlec
11+
link: https://github.com/baptiste-le-m
12+
image: https://github.com/baptiste-le-m.png?size=40
13+
- name: Pierre Zemb
14+
link: https://github.com/pierrez
15+
image: https://github.com/pierrez.png?size=40
16+
excludeSearch: true
17+
---
18+
19+
[Materia KV](/doc/addons/materia-kv/) adds six new commands to its Redis-compatible layer, expanding hash, string and TTL management capabilities:
20+
21+
- `GETDEL`: atomically get a string value and delete its key
22+
- `HEXISTS`: check if a field exists in a hash
23+
- `HSETNX`: set a hash field only if it does not already exist
24+
- `HINCRBY`: increment the integer value of a hash field
25+
- `EXPIREAT`: set key expiration using an absolute Unix timestamp in seconds
26+
- `PEXPIREAT`: set key expiration using an absolute Unix timestamp in milliseconds
27+
28+
These commands are available for new and already deployed add-ons, with no additional configuration.
29+
30+
This update also brings reliability improvements to the underlying storage layer.
31+
32+
The `SCAN`, `HSCAN`, `SSCAN` and `KEYS` commands now produce more accurate results thanks to fixes in the scan boundary logic.
33+
34+
Transactions now enforce retry limits of 5 retries with a 5-second timeout, preventing cascading retries from overwhelming the cluster under heavy contention. Previously, transactions could retry indefinitely on conflict.
35+
36+
- [Learn more about Materia KV](/doc/addons/materia-kv/)
37+
- [Learn more about Materia KV supported commands](/doc/addons/materia-kv/#supported-types-and-commands)

content/doc/addons/materia-kv.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,24 @@ Find below the list of currently supported commands:
154154
| `DEL` | Removes the specified `key`. A key is ignored if it doesn't exist. |
155155
| `EXISTS` | Returns if `key` exists. |
156156
| `EXPIRE` | Set a `key` time to live in seconds. After the timeout has expired, the `key` will be automatically deleted. The time to live can be updated using the `EXPIRE` command or cleared using the `PERSIST` command. |
157+
| `EXPIREAT` | Set a `key` to expire at the specified Unix timestamp (in seconds). After that time, the `key` will be automatically deleted. Returns `1` if the timeout was set, `0` if the `key` does not exist. |
157158
| `FLUSHALL` | Delete all the keys of all the existing databases, not just the currently selected one. This command never fails. |
158159
| `FLUSHDB` | Delete all the keys of the currently selected DB. This command never fails. |
159160
| `GET` | Get the value of `key`. If the `key` doesn't exist the special value nil is returned. An error is returned if the value stored at `key` is not a string, because `GET` only handles string values. |
160161
| `GETBIT` | Returns the bit value at offset in the string value stored at `key`. |
162+
| `GETDEL` | Get the value of `key` and delete the key. If the `key` doesn't exist, `nil` is returned. An error is returned if the value stored at `key` is not a string. |
161163
| `GETRANGE` | Returns the substring of the string value stored at `key`, determined by the offsets start and end (both are inclusive). Negative offsets can be used in order to provide an offset starting from the end of the string. So `-1` means the last character, `-2` the penultimate and so forth. |
162164
| `HDEL` | Removes the specified fields from the hash stored at `key`. Specified fields that do not exist within this hash are ignored. If `key` does not exist, it is treated as an empty hash and this command returns `0`. |
163165
| `HELLO` | Switch to a different protocol, optionally authenticating and setting the connection's name, or provide a contextual client report. It always replies with a list of current server and connection properties. |
166+
| `HEXISTS` | Returns `1` if `field` exists in the hash stored at `key`, `0` if `field` or `key` do not exist. An error is returned if the value stored at `key` is not a hash. |
164167
| `HGET` | Returns the value associated with `field` in the hash stored at `key`. If `key` does not exist, or `field` is not present in the hash, `nil` is returned. |
165168
| `HGETALL` | Returns all fields and values of the hash stored at `key`. In the returned value, every field name is followed by its value, so the length of the reply is twice the size of the hash. |
169+
| `HINCRBY` | Increments the number stored at `field` in the hash stored at `key` by the given `increment`. If `key` does not exist, a new key holding a hash is created. If `field` does not exist, the value is set to `0` before performing the operation. An error is returned if the field contains a value of the wrong type or the resulting value exceeds a 64-bit signed integer. |
166170
| `HLEN` | Returns the number of fields contained in the hash stored at `key`. If `key` does not exist, it is treated as an empty hash and `0` is returned. |
167171
| `HMGET` | Returns the values associated with the specified `fields` in the hash stored at `key`. For every field that does not exist in the hash, a `nil` value is returned. Because of this, the operation never fails. |
168172
| `HSCAN` | Incrementally iterate over hash fields and associated values. It is a cursor based iterator, this means that at every call of the command, the server returns an updated cursor that the user needs to use as the cursor argument in the next call. An iteration starts when the cursor is set to `0`, and terminates when the cursor returned by the server is `0`. |
169173
| `HSET` | Sets the specified fields to their respective values in the hash stored at `key`. If `key` does not exist, a new key holding a hash is created. If `key` exists but does not hold a hash, an error is returned. |
174+
| `HSETNX` | Sets `field` in the hash stored at `key` to `value`, only if `field` does not yet exist. If `key` does not exist, a new key holding a hash is created. If `field` already exists, the operation has no effect. Returns `1` if `field` is a new field in the hash and the value was set, `0` if `field` already exists. |
170175
| `INCR` | Increments the number stored at `key` by one. If the `key` doesn't exist, it is set to `0` before performing the operation. An error is returned if `key` contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64-bit signed integers. |
171176
| `INCRBY` | Increments the number stored at `key` by the given `increment`. If the `key` doesn't exist, it is set to `0` before performing the operation. An error is returned if `key` contains a value of the wrong type or contains a string that can not be represented as integer. This operation is limited to 64-bit signed integers. |
172177
| `INCRBYFLOAT` | Increment the string representing a floating point number stored at `key` by the specified `increment`. If the key does not exist, it is set to `0` before performing the operation. An error is returned if the key contains a value of the wrong type or a string that can not be represented as a floating point number. |
@@ -180,6 +185,7 @@ Find below the list of currently supported commands:
180185
| `MSET` | Sets the given keys to their respective values. `MSET` replaces existing values with new values, just as regular `SET`. `MSET` is atomic, so all given keys are set at once. It is not possible for clients to see that some keys were updated while others are unchanged. |
181186
| `PERSIST` | Remove the existing time to live associated with the `key`. |
182187
| `PEXPIRE` | Set a `key` time to live in milliseconds. After the timeout has expired, the `key` will be automatically deleted. The time to live can be updated using the `PEXPIRE` command or cleared using the `PERSIST` command. |
188+
| `PEXPIREAT` | Set a `key` to expire at the specified absolute Unix timestamp in milliseconds. After that time, the `key` will be automatically deleted. Returns `1` if the timeout was set, `0` if the `key` does not exist. |
183189
| `PING` | Returns `PONG` if no argument is provided, otherwise return a copy of the argument as a bulk. |
184190
| `PTTL` | Returns the remaining time to live of a `key`, in milliseconds. |
185191
| `SADD` | Add the specified members to the set stored at `key`. Specified members that are already a member of this set are ignored. If `key` doesn't exist, a new set is created before adding the specified members. |
@@ -200,9 +206,9 @@ Find below the list of currently supported commands:
200206
| `SRANDMEMBER` | When called with just the `key` argument, return a random element from the set value stored at `key`. |
201207
| `SREM` | Remove the specified members from the set stored at `key`. Specified members that are not a member of this set are ignored. If `key` doesn't exist, it is treated as an empty set and this command returns `0`. |
202208
| `SSCAN` | Incrementally iterate over set elements. It is a cursor based iterator, this means that at every call of the command, the server returns an updated cursor that the user needs to use as the cursor argument in the next call. An iteration starts when the cursor is set to `0`, and terminates when the cursor returned by the server is `0`. |
209+
| `STRLEN` | Returns the length of the string value stored at `key`. An error is returned when key holds a non-string value. |
203210
| `SUNION` | Returns the members of the set resulting from the union of all the given sets. |
204211
| `SUNIONSTORE` | This command is equal to `SUNION`, but instead of returning the resulting set, it is stored in `destination`. If `destination` already exists, it is overwritten. |
205-
| `STRLEN` | Returns the length of the string value stored at `key`. An error is returned when key holds a non-string value. |
206212
| `TTL` | Returns the remaining time to live of a `key`, in seconds. |
207213
| `TYPE` | Returns the string representation of the type of the value stored at `key`. Can be: `hash`, `list`, `set` or `string`. |
208214

0 commit comments

Comments
 (0)