Home

Awesome

rrlite

Build Status Coverage Status Status at rOpenSci software peer-review

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
## <redis_api>
##   Redis commands:
##     APPEND: function
##     AUTH: function
##     BGREWRITEAOF: function
##     BGSAVE: function
##     ...
##     ZSCORE: function
##     ZUNIONSTORE: function
##   Other public methods:
##     clone: function
##     command: function
##     config: function
##     initialize: function
##     pipeline: function
##     reconnect: function
##     subscribe: function
##     type: function

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")
## [Redis: OK]
con$GET("mykey")
## [1] "mydata"

As with redux, commands are vectorised:

con$MSET(c("a", "b", "c"), c(1, 2, 3))
## [Redis: OK]
con$MGET(c("a", "b", "c"))
## [[1]]
## [1] "1"
##
## [[2]]
## [1] "2"
##
## [[3]]
## [1] "3"

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