Skip to content

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

Notifications You must be signed in to change notification settings

djanowski/redis-scripted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published