rrlite

Build Status Coverage Status

knitr::opts_chunk$set(error=FALSE)

R interface to rlite. rlite is a "self-contained, serverless, zero-configuration, transactional redis-compatible database engine. rlite is to Redis what SQLite is to SQL. And Redis is a data structures server; at the simplest level it can be used as a key-value store, but it can store other data types (hashes, lists, sets and more).

This package is designed to follow exactly the same interface as redux.

Usage

See redux for more details.

The main function here is rrlite::hirlite that creates a redis_api object that exposes the full Redis API.

con <- rrlite::hirlite()
con
res <- capture.output(print(con))
res <- c(res[1:6], "    ...",
         res[(max(grep("\\s+[A-Z]", res)) - 2):length(res)])
writeLines(res)

This object has all the same methods as the corresponding object created by redux::hiredis() but operating on a rlite database. The default database uses the magic path :memory: but persistent on-disk storage is possible (see ?rlite_config).

All the usual Redis-type things work:

con$SET("mykey", "mydata")
con$GET("mykey")

As with redux, commands are vectorised:

con$MSET(c("a", "b", "c"), c(1, 2, 3))
con$MGET(c("a", "b", "c"))

Approach

This package aims to be a drop-in self-contained replacement for redux without requiring Redis server. Therefore almost the entire package (and tests) is automaticaly generated from redux. The only installed files not generated are:

Meta

rofooter



ropensci/rrlite documentation built on May 27, 2019, 6:33 p.m.