R/pubsub.R

Defines functions redisMonitorChannels

Documented in redisMonitorChannels

# Callback handler for convenience
redisMonitorChannels <- function(context, type=c("rdata", "raw", "string")) {
    type <- match.arg(type)
    x <- context$listen(type)
    if (length(x) != 3 || x[[1]] != "message") return(x)
    if (exists(x[[2]], mode="function")) {
        return(do.call(x[[2]],as.list(x[[3]])))
    }
    x
}

Try the RcppRedis package in your browser

Any scripts or data that you put into this service are public.

RcppRedis documentation built on Aug. 19, 2023, 5:13 p.m.