Class: Moneta::Adapters::TDB
- Inherits:
-
Moneta::Adapter
- Object
- Moneta::Adapter
- Moneta::Adapters::TDB
- Includes:
- EachKeySupport, HashAdapter, IncrementSupport
- Defined in:
- lib/moneta/adapters/tdb.rb
Overview
TDB backend
Instance Attribute Summary
Attributes included from HashAdapter
Attributes inherited from Moneta::Adapter
Instance Method Summary collapse
-
#close ⇒ Object
Explicitly close the store.
-
#create(key, value, options = {}) ⇒ Boolean
Atomically sets a key to value if it’s not set.
- #initialize(options = {}) ⇒ Object constructor
Methods included from EachKeySupport
Methods included from IncrementSupport
Methods included from HashAdapter
#clear, #delete, #fetch_values, #key?, #load, #merge!, #slice, #store, #values_at
Methods inherited from Moneta::Adapter
backend, backend_block, backend_required?
Methods included from Config
Methods included from Defaults
#[], #[]=, #decrement, #each_key, #features, #fetch, #fetch_values, included, #increment, #key?, #merge!, #slice, #supports?, #update, #values_at
Methods included from OptionSupport
#expires, #prefix, #raw, #with
Constructor Details
#initialize(options = {}) ⇒ Object
18 |
# File 'lib/moneta/adapters/tdb.rb', line 18 backend { |file:, **| ::TDB.new(file, ) } |
Instance Method Details
#close ⇒ Object
Explicitly close the store
21 22 23 24 |
# File 'lib/moneta/adapters/tdb.rb', line 21 def close backend.close nil end |
#create(key, value, options = {}) ⇒ Boolean
Note:
Not every Moneta store implements this method, a NotImplementedError is raised if it is not supported.
Atomically sets a key to value if it’s not set.
27 28 29 30 31 32 |
# File 'lib/moneta/adapters/tdb.rb', line 27 def create(key, value, = {}) backend.insert!(key, value) true rescue ::TDB::ERR::EXISTS false end |