0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby client that supports the experimental scripting feature of Redis
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

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.