Class: Moneta::Adapters::Sequel::Postgres Private
- Inherits:
-
Moneta::Adapters::Sequel
- Object
- Moneta::Adapters::Sequel
- Moneta::Adapters::Sequel::Postgres
- Defined in:
- lib/moneta/adapters/sequel.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from Moneta::Adapters::Sequel
#backend, #key_column, #value_column
Instance Method Summary collapse
- #delete(key, options = {}) ⇒ Object private
- #each_key ⇒ Object private
- #increment(key, amount = 1, options = {}) ⇒ Object private
- #merge!(pairs, options = {}, &block) ⇒ Object private
- #store(key, value, options = {}) ⇒ Object private
Methods inherited from Moneta::Adapters::Sequel
#clear, #close, #create, #fetch_values, #initialize, #key?, #load, new, #slice, #values_at
Methods included from Defaults
#[], #[]=, #close, #create, #decrement, #features, #fetch, #fetch_values, included, #key?, #slice, #supports?, #update, #values_at
Methods included from OptionSupport
#expires, #prefix, #raw, #with
Constructor Details
This class inherits a constructor from Moneta::Adapters::Sequel
Instance Method Details
#delete(key, 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.
403 404 405 406 407 408 |
# File 'lib/moneta/adapters/sequel.rb', line 403 def delete(key, = {}) result = @delete.call(key: key) if row = result.first row[value_column] end end |
#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.
422 423 424 425 426 427 428 429 |
# File 'lib/moneta/adapters/sequel.rb', line 422 def each_key return super unless block_given? && !@each_key_server && @table.respond_to?(:use_cursor) # With a cursor, this will Just Work. @table.select(key_column).paged_each do |row| yield row[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.
396 397 398 399 400 401 |
# File 'lib/moneta/adapters/sequel.rb', line 396 def increment(key, amount = 1, = {}) result = @increment.call(key: key, value: blob(amount.to_s), amount: amount) if row = result.first row[value_column].to_i 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.
410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/moneta/adapters/sequel.rb', line 410 def merge!(pairs, = {}, &block) @backend.transaction do pairs = yield_merge_pairs(pairs, &block) if block_given? @table .insert_conflict(target: key_column, update: { value_column => ::Sequel[:excluded][value_column] }) .import([key_column, 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.
391 392 393 394 |
# File 'lib/moneta/adapters/sequel.rb', line 391 def store(key, value, = {}) @store.call(key: key, value: blob(value)) value end |