Object
PStore backend @api public
@param [Hash] options @option options [String] :file PStore file @option options [::PStore] :backend Use existing backend instance
# File lib/moneta/adapters/pstore.rb, line 17 def initialize(options = {}) @backend = options[:backend] || begin raise ArgumentError, 'Option :file is required' unless options[:file] FileUtils.mkpath(::File.dirname(options[:file])) new_store(options) end end
(see Proxy#clear)
# File lib/moneta/adapters/pstore.rb, line 68 def clear(options = {}) @backend.transaction do @backend.roots.each do |key| @backend.delete(key) end end self end
(see Proxy#create)
# File lib/moneta/adapters/pstore.rb, line 56 def create(key, value, options = {}) @backend.transaction do if @backend.root?(key) false else @backend[key] = value true end end end
(see Proxy#delete)
# File lib/moneta/adapters/pstore.rb, line 42 def delete(key, options = {}) @backend.transaction { @backend.delete(key) } end
(see Proxy#increment)
# File lib/moneta/adapters/pstore.rb, line 47 def increment(key, amount = 1, options = {}) @backend.transaction do value = Utils.to_int(@backend[key]) + amount @backend[key] = value.to_s value end end
(see Proxy#key?)
# File lib/moneta/adapters/pstore.rb, line 27 def key?(key, options = {}) @backend.transaction(true) { @backend.root?(key) } end
(see Proxy#load)
# File lib/moneta/adapters/pstore.rb, line 32 def load(key, options = {}) @backend.transaction(true) { @backend[key] } end
(see Proxy#store)
# File lib/moneta/adapters/pstore.rb, line 37 def store(key, value, options = {}) @backend.transaction { @backend[key] = value } end
Generated with the Darkfish Rdoc Generator 2.