Class: Kaal::Backend::MySQL
- Defined in:
- lib/kaal/backend/mysql.rb
Overview
MySQL-backed backend for either Sequel or Active Record persistence.
Constant Summary collapse
- UNSET_SKIP_LOCKED_SUPPORT =
Object.new.freeze
Instance Method Summary collapse
- #acquire(key, ttl) ⇒ Object
- #definition_registry ⇒ Object
- #delayed_store ⇒ Object
- #dispatch_registry ⇒ Object
-
#initialize(database: nil, connection: nil, namespace: nil, use_skip_locked: UNSET_SKIP_LOCKED_SUPPORT) ⇒ MySQL
constructor
A new instance of MySQL.
- #release(key) ⇒ Object
Methods inherited from Adapter
Constructor Details
#initialize(database: nil, connection: nil, namespace: nil, use_skip_locked: UNSET_SKIP_LOCKED_SUPPORT) ⇒ MySQL
Returns a new instance of MySQL.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kaal/backend/mysql.rb', line 13 def initialize(database: nil, connection: nil, namespace: nil, use_skip_locked: UNSET_SKIP_LOCKED_SUPPORT) super() backend_class = self.class @engine = if database Kaal::Sequel.require_sequel! require 'kaal/internal/sequel' backend_class.send(:build_sequel_backend, database, namespace, use_skip_locked) else Kaal::ActiveRecord.require_activerecord! require 'kaal/internal/active_record' backend_class.send(:build_active_record_backend, connection, namespace, use_skip_locked) end end |
Instance Method Details
#acquire(key, ttl) ⇒ Object
40 41 42 |
# File 'lib/kaal/backend/mysql.rb', line 40 def acquire(key, ttl) @engine.acquire(key, ttl) end |
#definition_registry ⇒ Object
32 33 34 |
# File 'lib/kaal/backend/mysql.rb', line 32 def definition_registry @engine.definition_registry end |
#delayed_store ⇒ Object
36 37 38 |
# File 'lib/kaal/backend/mysql.rb', line 36 def delayed_store @engine.delayed_store end |
#dispatch_registry ⇒ Object
28 29 30 |
# File 'lib/kaal/backend/mysql.rb', line 28 def dispatch_registry @engine.dispatch_registry end |
#release(key) ⇒ Object
44 45 46 |
# File 'lib/kaal/backend/mysql.rb', line 44 def release(key) @engine.release(key) end |