Module: Linger
Defined Under Namespace
Modules: Authentication, Connections, Namespace
Classes: LogSubscriber, Railtie
Constant Summary
collapse
- VERSION =
"0.1.0"
Instance Method Summary
collapse
#clear_all, #configured_for
Methods included from Namespace
#namespace, #namespace=, #namespaced_key
#authenticate_connection!
Instance Method Details
#allow(*identifiers, **options) ⇒ Object
24
25
26
27
28
29
|
# File 'lib/linger.rb', line 24
def allow(*identifiers, **options)
key = build_key(identifiers)
instrument :meta, message: "Allowing #{key}" do
redis.set key, options[:data] || Time.zone.now
end
end
|
#deny(*identifiers) ⇒ Object
31
32
33
34
35
36
|
# File 'lib/linger.rb', line 31
def deny(*identifiers)
key = build_key(identifiers)
instrument :meta, message: "Denying #{key}" do
redis.del key
end
end
|
#instrument(channel, **options, &block) ⇒ Object
38
39
40
|
# File 'lib/linger.rb', line 38
def instrument(channel, **options, &block)
ActiveSupport::Notifications.instrument("#{channel}.linger", **options, &block)
end
|
#redis(config: :shared) ⇒ Object
20
21
22
|
# File 'lib/linger.rb', line 20
def redis(config: :shared)
configured_for(config)
end
|