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.
Constant Summary
Constants inherited from Moneta::Adapters::Sequel
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.
407 408 409 410 411 412 |
# File 'lib/moneta/adapters/sequel.rb', line 407 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.
427 428 429 430 431 432 433 434 |
# File 'lib/moneta/adapters/sequel.rb', line 427 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.
400 401 402 403 404 405 |
# File 'lib/moneta/adapters/sequel.rb', line 400 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.
414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/moneta/adapters/sequel.rb', line 414 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.
395 396 397 398 |
# File 'lib/moneta/adapters/sequel.rb', line 395 def store(key, value, = {}) @store.call(key: key, value: blob(value)) value end |