mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
11c6ce812a
The implementation expose the following new functions: 1. RedisModule_CursorCreate - allow to create a new cursor object for keys scanning 2. RedisModule_CursorRestart - restart an existing cursor to restart the scan 3. RedisModule_CursorDestroy - destroy an existing cursor 4. RedisModule_Scan - scan keys The RedisModule_Scan function gets a cursor object, a callback and void* (used as user private data). The callback will be called for each key in the database proving the key name and the value as RedisModuleKey.
18 lines
427 B
Tcl
18 lines
427 B
Tcl
set testmodule [file normalize tests/modules/scan.so]
|
|
|
|
proc count_log_message {pattern} {
|
|
set result [exec grep -c $pattern < [srv 0 stdout]]
|
|
}
|
|
|
|
start_server {tags {"modules"}} {
|
|
r module load $testmodule
|
|
|
|
test {Module scan} {
|
|
# the module create a scan command which also return values
|
|
r set x 1
|
|
r set y 2
|
|
r set z 3
|
|
lsort [r scan.scankeysvalues]
|
|
} {{x 1} {y 2} {z 3}}
|
|
|
|
} |