redict/tests/unit/moduleapi/scan.tcl
meir@redislabs.com 11c6ce812a Added scan implementation to module api.
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.
2019-11-11 16:01:41 +02:00

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}}
}