Files

Class/Module Index [+]

Quicksearch

Moneta::OptionSupport

@api private

Public Instance Methods

expires(expires) click to toggle source

Return Moneta store with default expiration time

@param [Integer] expires Default expiration time @return [OptionMerger] @api public

# File lib/moneta/mixins.rb, line 47
def expires(expires)
  with(:expires => expires, :only => [:store, :create, :increment])
end
prefix(prefix) click to toggle source

Return Moneta store with default prefix option

@param [String] prefix Key prefix @return [OptionMerger] @api public

# File lib/moneta/mixins.rb, line 38
def prefix(prefix)
  with(:prefix => prefix, :except => :clear)
end
raw() click to toggle source

Return Moneta store with default option :raw => true

@return [OptionMerger] @api public

# File lib/moneta/mixins.rb, line 24
def raw
  @raw_store ||=
    begin
      store = with(:raw => true, :only => [:load, :store, :create, :delete])
      store.instance_variable_set(:@raw_store, store)
      store
    end
end
with(options = nil, &block) click to toggle source

Return Moneta store with default options or additional proxies

@param [Hash] options Options to merge @return [Moneta store]

@api public

# File lib/moneta/mixins.rb, line 10
def with(options = nil, &block)
  adapter = self
  if block
    builder = Builder.new(&block)
    builder.adapter(adapter)
    adapter = builder.build.last
  end
  options ? OptionMerger.new(adapter, options) : adapter
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.