• Stars
    star
    84
  • Rank 387,728 (Top 8 %)
  • Language
    R
  • Created almost 9 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ“žπŸ’» Redis client for R

redux

Project Status: Active - The project has reached a stable, usable state and is being actively developed. R build status codecov.io

redux provides an interface to Redis. Two interfaces are provided; a low level interface (allowing execution of arbitrary Redis commands with almost no interface) and a high-level interface with an API that matches all of the several hundred Redis commands.

As well as supporting Redis commands, redux supports:

  • pipelineing: execute more than one command in a single Redis roundtrip, which can greatly increase performance, especially over high-latency connections.
  • socket connections: can connect to a locally running Redis instance over a unix socket (if Redis is configured to do so) for faster communication.
  • flexible serialisation: serialise any part of a Redis command, including keys and fields. Binary serialisation is supported via object_to_bin / bin_to_object, which are thin wrappers around serialize / unserialize
  • subscriptions: create a simple blocking subscribe client, applying a callback function to every message received.
  • error handling: Every Redis error becomes an R error.

redux also provides a driver for storr, allowing easy exchange of R objects between computers.

Usage

Create a hiredis object:

r <- redux::hiredis()

The hiredis object is a hiredis object with many (many methods), each corresponding to a different Redis command.

r
## <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

All the methods are available from this object; for example to set "foo" to "bar", use:

r$SET("foo", "bar")

See the package vignette for more information (vignette("redux")) or https://richfitz.github.io/redux/articles/redux.html

Testing

To use the test suite, please set the environment variables

  • NOT_CRAN=true
  • REDUX_TEST_USE_REDIS=true
  • REDUX_TEST_ISOLATED=true

The first two opt in to using redis at all, and the third activates commands that may be destructive or undesirable to use on a production server.

Installation

Install from CRAN with

install.packages("redux")

or install the development version with

remotes::install_github("richfitz/redux", upgrade = FALSE)

See also

There is considerable prior work in this space:

  • rredis, the original R Redis client
  • RcppRedis, Dirk Eddelbuettel's R Redis client, which greatly influenced the design decisions here
  • hiredis-rb, the Ruby Redis client that inspired the subscribe and pipeline support here.
  • rrlite, an almost identical interface to rlite, a serverless-zero configuration database with an identical interface to Redis

License

GPL-2 Β© Rich FitzJohn.

More Repositories

1

remake

Make-like declarative workflows in R
R
338
star
2

stevedore

☁️🚣🐳☁️ Docker client for R
R
134
star
3

storr

πŸ“¦ Object cacher for R
R
117
star
4

RcppR6

Code-generation wrapping C++ classes as R6 classes
R
54
star
5

thor

βš‘πŸ’»βš‘ R client for the Lightning Memory-Mapped Database
C
52
star
6

remoji

Emoji for R 😹
R
41
star
7

stegasaur

πŸ¦• Steganography for R
R
33
star
8

diversitree

diversitree: comparative phylogenetic analyses of diversification
R
27
star
9

reproducibility-2014

Talk on reproducible research at SURF: http://www.meetup.com/R-Users-Sydney/events/199742542/
TeX
27
star
10

pathr

Port of Python's os.path
R
19
star
11

wood

How much of the world is woody?
R
19
star
12

drat.builder

Build tools for a drat
R
16
star
13

rfiglet

R port of figlet
R
16
star
14

rainbowrite

🌈 Port of lolcat to R 🌈
R
14
star
15

forest

New Phylogenetics Data Structures in R
C++
10
star
16

sowsear

Frictionless literate programming: generate knitr files from R scripts
R
9
star
17

toxiproxyr

β˜£β˜£β˜£πŸ“ˆβ˜£β˜£β˜£ R interface to toxiproxy
R
7
star
18

rodeint

Interface to boost's odeint-v2
C++
7
star
19

jiffy

R interface to giphy πŸƒ Pronounced "yiffy"
R
5
star
20

thesis-style

Thesis style, vaguely suitable for UBC
TeX
5
star
21

rleveldb

🏒 LevelDB interface for R
R
4
star
22

remotefile

β˜οΈπŸ“β˜οΈ Download files when needed
R
4
star
23

httppipe

πŸ“  HTTP over named pipes (experimental and not very good)
Python
3
star
24

seagull

🐦 Portable file locking
R
2
star
25

git-intro

Material for teaching git
2
star
26

rc2016

Notes on mixing R and C/C++
C++
2
star
27

unpack

πŸŽ’ ➑️ πŸŒ΄πŸ§πŸ„πŸ‘½ Unpack RDS objects
C
2
star
28

vectoR

Vector image utilities for R
R
2
star
29

cppinfo

Extract C++ type information for use with R
R
2
star
30

mres-2022

git example
1
star
31

emacs

Simple configuration for emacs
Emacs Lisp
1
star
32

f5-steganography

Automatically exported from code.google.com/p/f5-steganography
Java
1
star
33

data

A test repository for datastorr
1
star
34

storr.server

R
1
star
35

kitten

(this was just a demo package for teaching packaging!)
R
1
star
36

R_practical_III

R
1
star
37

datastorr.example

R
1
star
38

advent-of-rust

Rust
1
star
39

rcmdshlib

πŸ‘· Build shared libraries for R, from R
R
1
star
40

simplemcmc

C++
1
star
41

yvr-2016

TeX
1
star
42

git-training

R
1
star
43

loggr.redis

Redis support for loggr
R
1
star