lib/ramaze/cache.rb in ramaze-0.1.1 vs lib/ramaze/cache.rb in ramaze-0.1.2

- old
+ new

@@ -10,21 +10,30 @@ # This is the wrapper of all caches, providing mechanism # for switching caching from one adapter to another. class Cache include Enumerable - CACHES = {} + CACHES = {} unless defined?(CACHES) - # This will define a method to access a new cache directly over - # sinleton-methods on Cache + class << self - def self.add *keys - keys.each do |key| - CACHES[key] = new - self.class.class_eval do - define_method(key){ CACHES[key] } + def startup(options) + Cache.add :compiled, :actions, :patterns, :resolved, :shield + end + + # This will define a method to access a new cache directly over + # sinleton-methods on Cache + + def add *keys + keys.each do |key| + CACHES[key] = new + self.class.class_eval do + define_method(key){ CACHES[key] } + end end + Inform.debug("Added caches for: #{keys.join(', ')}") end + end def initialize(cache = Global.cache) @cache = cache.new end