Class: Ramaze::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/ramaze/cache.rb,
lib/ramaze/cache/lru.rb,
lib/ramaze/cache/redis.rb,
lib/ramaze/cache/moneta.rb,
lib/ramaze/cache/sequel.rb,
lib/ramaze/cache/memcache.rb

Overview

:nodoc:

Defined Under Namespace

Classes: LRU, MemCache, Moneta, Redis, Sequel

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, klass = nil) ⇒ Cache

Overwrites Innate::Cache#initialize to make cache classes application aware. This prevents different applications running on the same host and user from overwriting eachothers data.

See Also:

  • Innate::Cache#initialize

Since:

  • 14-05-2012



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/ramaze/cache.rb', line 25

def initialize(name, klass = nil)
  @name      = name.to_s.dup.freeze
  klass    ||= options[@name.to_sym]
  @instance  = klass.new

  @instance.cache_setup(
    ENV['HOSTNAME'],
    ENV['USER'],
    Ramaze.options.app.name.to_s,
    @name
  )
end

Class Method Details

.clear_after_reloadObject

Clears the cache after a file has been reloaded.

Author:

  • Michael Fellinger

Since:

  • 17-07-2009



44
45
46
47
# File 'lib/ramaze/cache.rb', line 44

def self.clear_after_reload
  action.clear if respond_to?(:action)
  action_value.clear if respond_to?(:action_value)
end