You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Manage sets in Materia KV with new commands such as SADD, SREM, SMEMBERS, SISMEMBER or SCARD.
4
+
date: 2026-02-05
5
+
tags:
6
+
- addons
7
+
- materia
8
+
- kv
9
+
authors:
10
+
- name: David Legrand
11
+
link: https://github.com/davlgd
12
+
image: https://github.com/davlgd.png?size=40
13
+
excludeSearch: true
14
+
---
15
+
16
+
[Materia KV](/doc/addons/materia-kv/) now supports multiple commands to create and manage sets. You don't have anything to change in your configuration to benefit from this new feature, just use the new supported commands in your applications.
17
+
18
+
-[Learn more about Materia KV](/doc/addons/materia-kv/)
19
+
-[Learn more about Materia KV supported commands](/doc/addons/materia-kv/#supported-types-and-commands)
Copy file name to clipboardExpand all lines: content/doc/addons/materia-kv.md
+20-2Lines changed: 20 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,7 @@ We've prepared a few examples to help you get started with Materia KV:
133
133
Supported value types are:
134
134
135
135
- Hash
136
+
- Set
136
137
- String
137
138
138
139
Find below the list of currently supported commands:
@@ -180,13 +181,30 @@ Find below the list of currently supported commands:
180
181
|`PERSIST`| Remove the existing time to live associated with the `key`. |
181
182
|`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. |
182
183
|`PING`| Returns `PONG` if no argument is provided, otherwise return a copy of the argument as a bulk. |
183
-
|`PTTL`| RReturns the remaining time to live of a `key`, in milliseconds. |
184
+
|`PTTL`| Returns the remaining time to live of a `key`, in milliseconds. |
185
+
|`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. |
184
186
|`SCAN`| Incrementally iterate over a collection of 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`. |
187
+
|`SCARD`| Returns the set cardinality (number of elements) of the set stored at `key`. |
188
+
|`SDIFF`| Returns the members of the set resulting from the difference between the first set and all the successive sets. |
189
+
|`SDIFFSTORE`| This command is equal to `SDIFF`, but instead of returning the resulting set, it is stored in `destination`. If `destination` already exists, it is overwritten. |
185
190
|`SET`| Set `key` to hold the string `value`. If key already holds a value, it is overwritten, regardless of its type. |
186
191
|`SETBIT`| Sets or clears the bit at offset in the string value stored at `key`. |
192
+
|`SINTER`| Returns the members of the set resulting from the intersection of all the given sets. |
193
+
|`SINTERCARD`| Returns the number of elements that would result from the intersection of all given sets. |
194
+
|`SINTERSTORE`| This command is equal to `SINTER`, but instead of returning the resulting set, it is stored in `destination`. If `destination` already exists, it is overwritten. |
195
+
|`SISMEMBER`| Returns if `member` is a member of the set stored at `key`. |
196
+
|`SMEMBERS`| Returns all the members of the set value stored at `key`. |
197
+
|`SMISMEMBER`| Returns whether each member is a member of the set stored at `key`. For every member, `1` is returned if the value is a member of the set, or `0` if the element is not a member of the set or if `key` doesn't exist. |
198
+
|`SMOVE`| Move `member` from the set at `source` to the set at `destination`. This operation is atomic. In every given moment the element will appear to be a member of `source` or `destination` for other clients. |
199
+
|`SPOP`| Removes and returns one or more random members from the set value stored at `key`. |
200
+
|`SRANDMEMBER`| When called with just the `key` argument, return a random element from the set value stored at `key`. |
201
+
|`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`. |
202
+
|`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`. |
203
+
|`SUNION`| Returns the members of the set resulting from the union of all the given sets. |
204
+
|`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. |
187
205
|`STRLEN`| Returns the length of the string value stored at `key`. An error is returned when key holds a non-string value. |
188
206
|`TTL`| Returns the remaining time to live of a `key`, in seconds. |
189
-
|`TYPE`| Returns the string representation of the type of the value stored at `key`. Can be: `hash`, `list` or `string`. |
207
+
|`TYPE`| Returns the string representation of the type of the value stored at `key`. Can be: `hash`, `list`, `set` or `string`. |
0 commit comments