Skip to content

Commit

Permalink
cleanup config stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ssinghi committed Sep 23, 2011
1 parent 6349359 commit 6522633
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/acts_as_cached/benchmarking.rb
Expand Up @@ -19,7 +19,7 @@ def self.benchmark(event)
self.runtime += event.duration
return unless Rails.logger && Rails.logger.debug?

Rails.logger.debug("==> #{event.name} (#{'%.1fms' % event.duration})")
Rails.logger.debug("Cache #{event.name.sub('cache_','').sub('.active_support','')} ==> #{event.payload[:key]} (#{'%.1fms' % event.duration}) #{'HIT' if event.payload[:hit]}#{'MISS' if event.payload[:miss]}")
end
end
end
Expand Down
24 changes: 0 additions & 24 deletions lib/acts_as_cached/config.rb

This file was deleted.

11 changes: 7 additions & 4 deletions lib/cache_fu.rb
@@ -1,4 +1,3 @@
require File.dirname(__FILE__) + '/acts_as_cached/config'
require File.dirname(__FILE__) + '/acts_as_cached/cache_methods'
require File.dirname(__FILE__) + '/acts_as_cached/benchmarking'
require File.dirname(__FILE__) + '/acts_as_cached/disabled'
Expand All @@ -9,13 +8,17 @@ module ActsAsCached
mattr_reader :config

def self.config=(options)
@@config = Config.setup options
@@config = options
end

def self.skip_cache_gets=(boolean)
ActsAsCached.config[:skip_gets] = boolean
end

def self.valued_keys
[:version, :pages, :per_page, :finder, :cache_id, :find_by, :key_size]
end

module Mixin
def acts_as_cached(options = {})
extend ClassMethods
Expand All @@ -29,8 +32,8 @@ def acts_as_cached(options = {})
options[:cache_id] = find_by
end

cache_config.replace options.reject { |key,| not Config.valued_keys.include? key }
cache_options.replace options.reject { |key,| Config.valued_keys.include? key }
cache_config.replace options.reject { |key,| not ActsAsCached.valued_keys.include? key }
cache_options.replace options.reject { |key,| ActsAsCached.valued_keys.include? key }
end
end
end
Expand Down

0 comments on commit 6522633

Please sign in to comment.