Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Ruby client that supports the experimental scripting feature of Redis.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 redis-scripted.gemspec
README.md

Redis::Scripted

A Ruby client that supports the experimental scripting feature in Redis.

Usage

Drop your Lua scripts in ./scripts:

scripts/
├── msadd.lua
└── sintercard.lua

Then initialize the connection to Redis, passing the path where the class should look for scripts:

require "redis/scripted"

redis = Redis::Scripted.connect(scripts_path: "./scripts")

The scripts are defined as instance methods for convenience:

redis.msadd(["foo"], ["s1", "s2", "s3"])

Note that msadd receives two arguments at most: one array for the keys and another for the values. This is necessary because of how EVAL works.

The class also exposes the eval and evalsha methods if you want to call them yourself.

Acknowledgments

Code was inspired by mkrecny, catwell and dsander.

Something went wrong with that request. Please try again.