Namespace

Methods

Files

Padrino

Public Class Methods

cache() click to toggle source

Returns the caching engine

@example

# with: Padrino.cache = Padrino::Cache::Store::File.new(/my/cache/path)
Padrino.cache.set('val', 'test')
Padrino.cache.get('val') # => 'test'
Padrino.cache.delete('val')
Padrino.cache.flush

@api public

# File lib/padrino-cache.rb, line 19
def cache
  @_cache
end
cache=(value) click to toggle source

Set the caching engine

@param value

Instance of Padrino::Cache::Store

@example

Padrino.cache = Padrino::Cache::Store::Memcache.new(::Memcached.new('127.0.0.1:11211', :exception_retry_limit => 1))
Padrino.cache = Padrino::Cache::Store::Memcache.new(::Dalli::Client.new('127.0.0.1:11211', :exception_retry_limit => 1))
Padrino.cache = Padrino::Cache::Store::Redis.new(::Redis.new(:host => '127.0.0.1', :port => 6379, :db => 0))
Padrino.cache = Padrino::Cache::Store::Mongo.new(::Mongo::Connection.new('127.0.0.1', 27017).db('padrino'), :username => 'username', :password => 'password', :size => 64, :max => 100, :collection => 'cache')
Padrino.cache = Padrino::Cache::Store::Memory.new(50)
Padrino.cache = Padrino::Cache::Store::File.new(/my/cache/path)

# You can manage your cache from anywhere in your app:

Padrino.cache.set('val', 'test')
Padrino.cache.get('val') # => 'test'
Padrino.cache.delete('val')
Padrino.cache.flush

@api public

# File lib/padrino-cache.rb, line 45
def cache=(value)
  @_cache = value
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.