Class: Conflow::Redis::Script
- Inherits:
-
Object
- Object
- Conflow::Redis::Script
- Defined in:
- lib/conflow/redis/script.rb
Overview
Main class for scripts, handling logic of executing and caching scripts.
Direct Known Subclasses
Class Attribute Summary collapse
-
.cache_scripts ⇒ Object
This options decides whether scripts used by the gem will be cached in Redis or not.
-
.script ⇒ String
readonly
LUA script of this Conflow::Redis::Script.
Class Method Summary collapse
-
.call(keys, args = []) ⇒ Object
Executes script in Redis with given arguments.
-
.inherited(base) ⇒ Object
Sets cache_scripts option on inherited scripts.
Class Attribute Details
.cache_scripts ⇒ Object
This options decides whether scripts used by the gem will be cached in Redis or not. See Redis EVAL and Redis EVALSHA.
9 10 11 |
# File 'lib/conflow/redis/script.rb', line 9 def cache_scripts @cache_scripts end |
.script ⇒ String
Returns LUA script of this Conflow::Redis::Script.
11 12 13 |
# File 'lib/conflow/redis/script.rb', line 11 def script @script end |
Class Method Details
.call(keys, args = []) ⇒ Object
Executes script in Redis with given arguments.
37 38 39 |
# File 'lib/conflow/redis/script.rb', line 37 def call(*args) Conflow.redis.with { |conn| send(command, conn, args) } end |
.inherited(base) ⇒ Object
Sets cache_scripts option on inherited scripts
14 15 16 17 18 |
# File 'lib/conflow/redis/script.rb', line 14 def inherited(base) scripts << base base.cache_scripts = cache_scripts super end |