Support for iterating with SCAN
. Note that this generalises to
support collecting output, SSCAN
and other variants, etc.
Usage
scan_apply(
con,
callback,
pattern = NULL,
...,
count = NULL,
type = "SCAN",
key = NULL
)
scan_del(con, pattern, count = NULL, type = "SCAN", key = NULL)
scan_find(con, pattern, count = NULL, type = "SCAN", key = NULL)
Arguments
- con
A redis_api object
- callback
Function that takes a character vector of keys and does something useful to it.
con$DEL
is one option here to delete keys that match a pattern. Unlike R's*apply
functions, callback is called for its side effects and its return values will be ignored.- pattern
Optional pattern to use.
- ...
additional arguments passed through to
callback
. Note that if used,pattern
must be provided (at least asNULL
).- count
Optional step size (default is Redis' default which is 10)
- type
Type of
SCAN
to run. Options are"SCAN"
(the default),"HSCAN"
(scan through keys of a hash),"SSCAN"
(scan through elements of a set) and"ZSCAN"
(scan though elements of a sorted set). Iftype
is not"SCAN"
, thenkey
must be provided.HSCAN
andZSCAN
currently do not work usefully.- key
Key to use when running a hash, set or sorted set scan.