module Tennpipes
Public Class Methods
cache()
click to toggle source
Returns the caching engine.
@example
# with: Tennpipes.cache = Tennpipes::Cache.new(:File, :dir => /my/cache/path) Tennpipes.cache['val'] = 'test' Tennpipes.cache['val'] # => 'test' Tennpipes.cache.delete('val') Tennpipes.cache.clear
# File lib/tennpipes-memory.rb, line 19 def cache @_cache end
cache=(value)
click to toggle source
Set the caching engine.
@param value
Instance of Moneta store
@example
Tennpipes.cache = Tennpipes::Cache.new(:LRUHash) # default choice Tennpipes.cache = Tennpipes::Cache.new(:File, :dir => Tennpipes.root('tmp', app_name.to_s, 'cache')) # Keeps cached values in file Tennpipes.cache = Tennpipes::Cache.new(:Memcached) # Uses default server at localhost Tennpipes.cache = Tennpipes::Cache.new(:Memcached, :server => '127.0.0.1:11211', :exception_retry_limit => 1) Tennpipes.cache = Tennpipes::Cache.new(:Memcached, :backend => memcached_or_dalli_instance) Tennpipes.cache = Tennpipes::Cache.new(:Redis) # Uses default server at localhost Tennpipes.cache = Tennpipes::Cache.new(:Redis, :host => '127.0.0.1', :port => 6379, :db => 0) Tennpipes.cache = Tennpipes::Cache.new(:Redis, :backend => redis_instance) Tennpipes.cache = Tennpipes::Cache.new(:Mongo) # Uses default server at localhost Tennpipes.cache = Tennpipes::Cache.new(:Mongo, :backend => mongo_client_instance) # You can manage your cache from anywhere in your app: Tennpipes.cache['val'] = 'test' Tennpipes.cache['val'] # => 'test' Tennpipes.cache.delete('val') Tennpipes.cache.clear
# File lib/tennpipes-memory.rb, line 48 def cache=(value) @_cache= value end