<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>actionpack/lib/abstract_controller/localized_cache.rb</filename>
    </added>
    <added>
      <filename>actionpack/test/abstract/localized_cache_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -254,6 +254,7 @@ module ActionMailer #:nodoc:
     include AdvAttrAccessor, PartContainer, Quoting, Utils
 
     include AbstractController::RenderingController
+    include AbstractController::LocalizedCache
     include AbstractController::Layouts
 
     include AbstractController::Helpers</diff>
      <filename>actionmailer/lib/action_mailer/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@ module AbstractController
   autoload :Callbacks,           &quot;abstract_controller/callbacks&quot;
   autoload :Helpers,             &quot;abstract_controller/helpers&quot;
   autoload :Layouts,             &quot;abstract_controller/layouts&quot;
+  autoload :LocalizedCache,      &quot;abstract_controller/localized_cache&quot;
   autoload :Logger,              &quot;abstract_controller/logger&quot;
   autoload :RenderingController, &quot;abstract_controller/rendering_controller&quot;
   # === Exceptions</diff>
      <filename>actionpack/lib/abstract_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,39 +1,10 @@
 module ActionController
-  class HashKey
-    @hash_keys = Hash.new {|h,k| h[k] = Hash.new {|h,k| h[k] = {} } }
-
-    def self.get(klass, formats, locale)
-      @hash_keys[klass][formats][locale] ||= new(klass, formats, locale)
-    end
-
-    attr_accessor :hash
-    def initialize(klass, formats, locale)
-      @formats, @locale = formats, locale
-      @hash = [formats, locale].hash
-    end
-
-    alias_method :eql?, :equal?
-
-    def inspect
-      &quot;#&lt;HashKey -- formats: #{@formats} locale: #{@locale}&gt;&quot;
-    end
-  end
-
   module RenderingController
     extend ActiveSupport::Concern
 
-    include AbstractController::RenderingController
-
-    module ClassMethods
-      def clear_template_caches!
-        ActionView::Partials::PartialRenderer::TEMPLATES.clear
-        template_cache.clear
-        super
-      end
-
-      def template_cache
-        @template_cache ||= Hash.new {|h,k| h[k] = {} }
-      end
+    included do
+      include AbstractController::RenderingController
+      include AbstractController::LocalizedCache
     end
 
     def process_action(*)
@@ -42,8 +13,6 @@ module ActionController
     end
 
     def render(options)
-      Thread.current[:format_locale_key] = HashKey.get(self.class, formats, I18n.locale)
-
       super
       self.content_type ||= options[:_template].mime_type.to_s
       response_body
@@ -78,10 +47,6 @@ module ActionController
         formats.first
       end
 
-      def with_template_cache(name)
-        self.class.template_cache[Thread.current[:format_locale_key]][name] ||= super
-      end
-
       def _process_options(options)
         status, content_type, location = options.values_at(:status, :content_type, :location)
         self.status = status if status</diff>
      <filename>actionpack/lib/action_controller/metal/rendering_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -187,11 +187,11 @@ module ActionView #:nodoc:
     def reset_formats(formats)
       @formats = formats
 
-      if defined?(ActionController)
+      if defined?(AbstractController::HashKey)
         # This is expensive, but we need to reset this when the format is updated,
         # which currently only happens
         Thread.current[:format_locale_key] =
-          ActionController::HashKey.get(self.class, formats, I18n.locale)
+          AbstractController::HashKey.get(self.class, formats, I18n.locale)
       end
     end
 </diff>
      <filename>actionpack/lib/action_view/base.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>a107103e85a2cc294faedddbb44707fd2bc2e206</id>
    </parent>
  </parents>
  <author>
    <name>Jos&#233; Valim</name>
    <email>jose.valim@gmail.com</email>
  </author>
  <url>http://github.com/feldpost/rails/commit/976c2647240fd40a2b706ab5e41856cd47e7b212</url>
  <id>976c2647240fd40a2b706ab5e41856cd47e7b212</id>
  <committed-date>2009-10-31T18:23:49-07:00</committed-date>
  <authored-date>2009-10-28T05:33:05-07:00</authored-date>
  <message>Extracted localized_cache.rb from ActionController, added it to AbstractController and made ActionMailer use it.</message>
  <tree>424a54f1b025cf8e3d17dcd15632d68eb62a78ef</tree>
  <committer>
    <name>Yehuda Katz</name>
    <email>wycats@gmail.com</email>
  </committer>
</commit>
