Module: RedisLocker
- Defined in:
- lib/redis_locker.rb,
lib/redis_locker/errors.rb,
lib/redis_locker/locker.rb,
lib/redis_locker/version.rb,
lib/redis_locker/model_locker.rb,
lib/redis_locker/configuration.rb,
lib/redis_locker/method_locker.rb,
lib/redis_locker/redis_connection.rb
Defined Under Namespace
Modules: ClassMethods, Errors, InstanceMethods, RedisConnection
Classes: Configuration, Locker, MethodLocker, ModelLocker
Constant Summary
collapse
- STRATEGIES =
%i[exception retry silently_die].freeze
- DEFAULT_RETRY_COUNT =
3
- DEFAULT_RETRY_INTERVAL =
1
- MODEL_LOCK_STRING =
"model_lock"
- DEFAULT_STRATEGY =
:exception
- DEFAULT_EXCLUDED_METHODS =
%i[id initialize].freeze
- VERSION =
"0.1.3"
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
13
14
15
|
# File 'lib/redis_locker.rb', line 13
def configuration
@configuration ||= Configuration.new
end
|
17
18
19
|
# File 'lib/redis_locker.rb', line 17
def configure
yield(configuration)
end
|
.included(base_klass) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/redis_locker.rb', line 28
def self.included(base_klass)
base_klass.extend(ClassMethods)
base_klass.include(InstanceMethods)
interceptor = base_klass.const_set("#{base_klass.name.split('::').last}Interceptor", Module.new)
base_klass.prepend interceptor
end
|
.release_locks! ⇒ Object
21
22
23
|
# File 'lib/redis_locker.rb', line 21
def release_locks!
configuration.redis_connection.del(configuration.redis_connection.keys("LOCKER:*"))
end
|