Class: Kaal::Backend::SQLite
- Defined in:
- lib/kaal/backend/sqlite.rb
Overview
SQLite-backed backend for either Sequel or Active Record persistence.
Instance Method Summary collapse
- #acquire(key, ttl) ⇒ Object
- #definition_registry ⇒ Object
- #dispatch_registry ⇒ Object
-
#initialize(database: nil, connection: nil, namespace: nil) ⇒ SQLite
constructor
A new instance of SQLite.
- #release(key) ⇒ Object
Methods inherited from Adapter
Constructor Details
#initialize(database: nil, connection: nil, namespace: nil) ⇒ SQLite
Returns a new instance of SQLite.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kaal/backend/sqlite.rb', line 11 def initialize(database: nil, connection: nil, namespace: nil, **) super() @engine = if database Kaal::Sequel.require_sequel! require 'kaal/internal/sequel' Kaal::Internal::Sequel::DatabaseBackend.new(database, namespace:) else Kaal::ActiveRecord.require_activerecord! require 'kaal/internal/active_record' Kaal::Internal::ActiveRecord::DatabaseBackend.new(connection, namespace:, **) end end |
Instance Method Details
#acquire(key, ttl) ⇒ Object
32 33 34 |
# File 'lib/kaal/backend/sqlite.rb', line 32 def acquire(key, ttl) @engine.acquire(key, ttl) end |
#definition_registry ⇒ Object
28 29 30 |
# File 'lib/kaal/backend/sqlite.rb', line 28 def definition_registry @engine.definition_registry end |
#dispatch_registry ⇒ Object
24 25 26 |
# File 'lib/kaal/backend/sqlite.rb', line 24 def dispatch_registry @engine.dispatch_registry end |
#release(key) ⇒ Object
36 37 38 |
# File 'lib/kaal/backend/sqlite.rb', line 36 def release(key) @engine.release(key) end |