Module: RedisLocker::InstanceMethods

Defined in:
lib/redis_locker.rb

Instance Method Summary collapse

Instance Method Details

#lockObject



69
70
71
# File 'lib/redis_locker.rb', line 69

def lock
  model_locker.lock
end

#lock!Object



73
74
75
# File 'lib/redis_locker.rb', line 73

def lock!
  model_locker.lock!
end

#method_locker(method) ⇒ Object



65
66
67
# File 'lib/redis_locker.rb', line 65

def method_locker(method)
  method_lockers[method] ||= RedisLocker::MethodLocker.new(model_locker, method)
end

#unlockObject



77
78
79
# File 'lib/redis_locker.rb', line 77

def unlock
  model_locker.unlock
end

#with_redis_lock(strategy: RedisLocker::DEFAULT_STRATEGY, retry_count: RedisLocker::DEFAULT_RETRY_COUNT, retry_interval: RedisLocker::DEFAULT_RETRY_INTERVAL, &block) ⇒ Object



81
82
83
84
# File 'lib/redis_locker.rb', line 81

def with_redis_lock(strategy: RedisLocker::DEFAULT_STRATEGY, retry_count: RedisLocker::DEFAULT_RETRY_COUNT,
                    retry_interval: RedisLocker::DEFAULT_RETRY_INTERVAL, &block)
  model_locker.with_redis_lock(strategy: strategy, retry_count: retry_count, retry_interval: retry_interval, &block)
end