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$DELis one option here to delete keys that match a pattern. Unlike R's*applyfunctions, 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,patternmust be provided (at least asNULL).- count
Optional step size (default is Redis' default which is 10)
- type
Type of
SCANto 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). Iftypeis not"SCAN", thenkeymust be provided.HSCANandZSCANcurrently do not work usefully.- key
Key to use when running a hash, set or sorted set scan.