Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source
Show
Ignore:
Timestamp:
12/16/07 16:56:42 (9 months ago)
Author:
david
Message:

Introduce cache_key management and expansion

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2-1-caching/actionpack/lib/action_controller/caching.rb

    r8414 r8415  
    5757      def cache(key, options = nil, &block) 
    5858        if cache_configured? 
    59           cache_store.fetch(key.to_param, options, &block) 
     59          cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block) 
    6060        else 
    6161          yield 
     
    6464 
    6565 
    66     private 
     66    private     
    6767      def cache_configured? 
    6868        self.class.cache_configured? 
  • branches/2-1-caching/actionpack/lib/action_controller/caching/fragments.rb

    r8414 r8415  
    5858        # value of url_for on that hash (without the protocol). 
    5959        def fragment_cache_key(key) 
    60           key.is_a?(Hash) ? url_for(key).split("://").last : key.to_param 
     60          ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key).split("://").last : key, :fragments) 
    6161        end 
    6262 
     
    8282          key = fragment_cache_key(key) 
    8383 
    84           self.class.benchmark "Cached fragment: #{key}" do 
     84          self.class.benchmark "Cached fragment miss: #{key}" do 
    8585            cache_store.write(key, content, options) 
    8686          end 
     
    9595          key = fragment_cache_key(key) 
    9696 
    97           self.class.benchmark "Fragment read: #{key}" do 
     97          self.class.benchmark "Cached fragment hit: #{key}" do 
    9898            cache_store.read(key, options) 
    9999          end