Skip to content

Instantly share code, notes, and snippets.

@pedro pedro/init.r
Last active Aug 29, 2015

Embed
What would you like to do?
R + Redis on Heroku
# used by the R buildpack to install dependencies:
# https://github.com/virtualstaticvoid/heroku-buildpack-r
install.packages("rredis", dependencies = TRUE)
library("rredis")
redis_url <- Sys.getenv("REDIS_URL")
host <- gsub("redis://.*@(.+):.*", "\\1", redis_url)
pass <- gsub("redis://.*:(.+)@.*", "\\1", redis_url)
port <- as.integer(gsub(".*:(.*)$", "\\1", redis_url))
redisConnect(host=host, port=port, password=pass)
# set/get stuff:
redisSet("foo", "bar")
print(redisGet("foo"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.