Module: RedisQueuedLocks::Acquirer::ExtendLockTTL Private
- Defined in:
- lib/redis_queued_locks/acquirer/extend_lock_ttl.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- EXTEND_LOCK_PTTL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"local new_lock_pttl = redis.call(\"PTTL\", KEYS[1]) + ARGV[1];\nreturn redis.call(\"PEXPIRE\", KEYS[1], new_lock_pttl);\n".strip.tr("\n", '').freeze
Class Method Summary collapse
Class Method Details
.extend_lock_ttl(redis_client, lock_name, milliseconds, logger, instrumenter, instrument, log_sampling_enabled, log_sampling_percent, log_sampler, log_sample_this, instr_sampling_enabled, instr_sampling_percent, instr_sampler, instr_sample_this) ⇒ Hash<Symbol,Boolean|Symbol>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/redis_queued_locks/acquirer/extend_lock_ttl.rb', line 35 def extend_lock_ttl( redis_client, lock_name, milliseconds, logger, instrumenter, instrument, log_sampling_enabled, log_sampling_percent, log_sampler, log_sample_this, instr_sampling_enabled, instr_sampling_percent, instr_sampler, instr_sample_this ) lock_key = RedisQueuedLocks::Resource.prepare_lock_key(lock_name) # NOTE: EVAL signature -> <lua script>, (number of keys), *(keys), *(arguments) result = redis_client.call('EVAL', EXTEND_LOCK_PTTL, 1, lock_key, milliseconds) # TODO: upload scripts to the redis # @type var result: Integer if result == 1 { ok: true, result: :ttl_extended } else { ok: false, result: :async_expire_or_no_lock } end end |