Method: Sohm::Model#script
- Defined in:
- lib/sohm.rb
#script(file, *args) ⇒ Object
Run lua scripts and cache the sha in order to improve successive calls.
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 |
# File 'lib/sohm.rb', line 1189 def script(file, *args) response = nil if Sohm.enable_evalsha response = redis.call("EVALSHA", LUA_SAVE_DIGEST, *args) if response.is_a?(RuntimeError) if response. =~ /NOSCRIPT/ response = nil end end end response ? response : redis.call("EVAL", LUA_SAVE, *args) end |