Module: Moneta::Adapters::Sequel::MySQL Private
- Defined in:
- lib/moneta/adapters/sequel/mysql.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #each_key ⇒ Object private
- #increment(key, amount = 1, options = {}) ⇒ Object private
- #merge!(pairs, options = {}, &block) ⇒ Object private
- #store(key, value, options = {}) ⇒ Object private
Instance Method Details
#each_key ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 34 35 36 |
# File 'lib/moneta/adapters/sequel/mysql.rb', line 29 def each_key return super unless block_given? && config.each_key_server && @table.respond_to?(:stream) # Order is not required when streaming @table.server(config.each_key_server).select(config.key_column).paged_each do |row| yield row[config.key_column] end self end |
#increment(key, amount = 1, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 14 15 16 |
# File 'lib/moneta/adapters/sequel/mysql.rb', line 11 def increment(key, amount = 1, = {}) @backend.transaction(retry_on: [::Sequel::SerializationFailure]) do @increment.call(key: key, amount: amount) Integer(load(key)) end end |
#merge!(pairs, options = {}, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/moneta/adapters/sequel/mysql.rb', line 18 def merge!(pairs, = {}, &block) @backend.transaction do pairs = yield_merge_pairs(pairs, &block) if block_given? @table .on_duplicate_key_update .import([config.key_column, config.value_column], blob_pairs(pairs).to_a) end self end |
#store(key, value, options = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 9 |
# File 'lib/moneta/adapters/sequel/mysql.rb', line 6 def store(key, value, = {}) @store.call(key: key, value: blob(value)) value end |