module SidekiqUniqueJobs::Script::Caller
def call_script(file_name, *args)
-
(true, false, String, Integer, Float, nil)
- returns the return value of the lua script
Options Hash:
(**options)
-
:argv
(Array
) -- arguments to pass to the script -
:keys
(Array
) -- to pass to the script
Parameters:
-
options
(Hash
) -- arguments to pass to the script file -
conn
(Redis
) -- a redis connection -
file_name
(Symbol
) -- the name of the file -
conn
(Redis
) -- a redis connection -
argv
(Array
) -- arguments to pass to the script -
keys
(Array
) -- to pass to the the script -
file_name
(Symbol
) -- the name of the file
Overloads:
-
call_script(file_name, conn, keys:, argv:)
-
call_script(file_name, keys, argv, conn)
def call_script(file_name, *args) conn, keys, argv = extract_args(*args) return do_call(file_name, conn, keys, argv) if conn pool = defined?(redis_pool) ? redis_pool : nil redis(pool) do |new_conn| do_call(file_name, new_conn, keys, argv) end end
def debug_lua
- See: SidekiqUniqueJobs::Config#debug_lua -
def debug_lua SidekiqUniqueJobs.config.debug_lua end
def do_call(file_name, conn, keys, argv)
- See: call_script -
def do_call(file_name, conn, keys, argv) argv = argv.dup.concat([ now_f, debug_lua, max_history, file_name, redis_version, ]) Script.execute(file_name, conn, keys: keys, argv: argv) end
def extract_args(*args)
-
(Array
-)
Options Hash:
(**options)
-
:argv
(Array
) -- arguments to pass to the script -
:keys
(Array
) -- to pass to the script
Parameters:
-
options
(Hash
) -- arguments to pass to the script file -
conn
(Redis
) -- a redis connection -
file_name
(Symbol
) -- the name of the file -
conn
(Redis
) -- a redis connection -
argv
(Array
) -- arguments to pass to the script -
keys
(Array
) -- to pass to the the script -
file_name
(Symbol
) -- the name of the file
Overloads:
-
call_script(file_name, conn, keys:, argv:)
-
call_script(file_name, keys, argv, conn)
def extract_args(*args) options = args.extract_options! if options.length.positive? [args.pop, options.fetch(:keys) { [] }, options.fetch(:argv) { [] }] else keys, argv = args.shift(2) keys ||= [] argv ||= [] [args.pop, keys, argv] end end
def max_history
- See: SidekiqUniqueJobs::Config#max_history -
def max_history SidekiqUniqueJobs.config.max_history end
def now_f
- See: SidekiqUniqueJobs#now_f -
def now_f SidekiqUniqueJobs.now_f end
def redis_version
- See: SidekiqUniqueJobs::Config#max_history -
def redis_version SidekiqUniqueJobs.config.redis_version end