<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,9 @@
 *Edge*
 
+* Allow caches_action to accept cache store options. #416. [Jos&#233; Valim]. Example:
+  
+  caches_action :index, :redirected, :if =&gt; Proc.new { |c| !c.request.format.json? }, :expires_in =&gt; 1.hour
+
 * Remove define_javascript_functions, javascript_include_tag and friends are far superior. [Michael Koziarski]
 
 * Deprecate :use_full_path render option. The supplying the option no longer has an effect [Josh Peek]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -27,13 +27,15 @@ module ActionController #:nodoc:
     # You can set modify the default action cache path by passing a :cache_path option.  This will be passed directly to ActionCachePath.path_for.  This is handy
     # for actions with multiple possible routes that should be cached differently.  If a block is given, it is called with the current controller instance.
     #
-    # And you can also use :if to pass a Proc that specifies when the action should be cached.
+    # And you can also use :if (or :unless) to pass a Proc that specifies when the action should be cached.
+    #
+    # Finally, if you are using memcached, you can also pass :expires_in.
     #
     #   class ListsController &lt; ApplicationController
     #     before_filter :authenticate, :except =&gt; :public
     #     caches_page   :public
     #     caches_action :index, :if =&gt; Proc.new { |c| !c.request.format.json? } # cache if is not a JSON request
-    #     caches_action :show, :cache_path =&gt; { :project =&gt; 1 }
+    #     caches_action :show, :cache_path =&gt; { :project =&gt; 1 }, :expires_in =&gt; 1.hour
     #     caches_action :feed, :cache_path =&gt; Proc.new { |controller|
     #       controller.params[:user_id] ?
     #         controller.send(:user_list_url, c.params[:user_id], c.params[:id]) :
@@ -56,8 +58,10 @@ module ActionController #:nodoc:
         def caches_action(*actions)
           return unless cache_configured?
           options = actions.extract_options!
-          cache_filter = ActionCacheFilter.new(:layout =&gt; options.delete(:layout), :cache_path =&gt; options.delete(:cache_path))
-          around_filter(cache_filter, {:only =&gt; actions}.merge(options))
+          filter_options = { :only =&gt; actions, :if =&gt; options.delete(:if), :unless =&gt; options.delete(:unless) }
+
+          cache_filter = ActionCacheFilter.new(:layout =&gt; options.delete(:layout), :cache_path =&gt; options.delete(:cache_path), :store_options =&gt; options)
+          around_filter(cache_filter, filter_options)
         end
       end
 
@@ -80,8 +84,8 @@ module ActionController #:nodoc:
         end
 
         def before(controller)
-          cache_path = ActionCachePath.new(controller, path_options_for(controller, @options))
-          if cache = controller.read_fragment(cache_path.path)
+          cache_path = ActionCachePath.new(controller, path_options_for(controller, @options.slice(:cache_path)))
+          if cache = controller.read_fragment(cache_path.path, @options[:store_options])
             controller.rendered_action_cache = true
             set_content_type!(controller, cache_path.extension)
             options = { :text =&gt; cache }
@@ -96,7 +100,7 @@ module ActionController #:nodoc:
         def after(controller)
           return if controller.rendered_action_cache || !caching_allowed(controller)
           action_content = cache_layout? ? content_for_layout(controller) : controller.response.body
-          controller.write_fragment(controller.action_cache_path.path, action_content)
+          controller.write_fragment(controller.action_cache_path.path, action_content, @options[:store_options])
         end
 
         private</diff>
      <filename>actionpack/lib/action_controller/caching/actions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -152,7 +152,7 @@ end
 
 
 class ActionCachingTestController &lt; ActionController::Base
-  caches_action :index, :redirected, :forbidden, :if =&gt; Proc.new { |c| !c.request.format.json? }
+  caches_action :index, :redirected, :forbidden, :if =&gt; Proc.new { |c| !c.request.format.json? }, :expires_in =&gt; 1.hour
   caches_action :show, :cache_path =&gt; 'http://test.host/custom/show'
   caches_action :edit, :cache_path =&gt; Proc.new { |c| c.params[:id] ? &quot;http://test.host/#{c.params[:id]};edit&quot; : &quot;http://test.host/edit&quot; }
   caches_action :with_layout
@@ -188,6 +188,7 @@ class ActionCachingTestController &lt; ActionController::Base
     expire_action :controller =&gt; 'action_caching_test', :action =&gt; 'index'
     render :nothing =&gt; true
   end
+
   def expire_xml
     expire_action :controller =&gt; 'action_caching_test', :action =&gt; 'index', :format =&gt; 'xml'
     render :nothing =&gt; true
@@ -289,6 +290,13 @@ class ActionCacheTest &lt; Test::Unit::TestCase
     assert !fragment_exist?('hostname.com/action_caching_test')
   end
 
+  def test_action_cache_with_store_options
+    MockTime.expects(:now).returns(12345).once
+    @controller.expects(:read_fragment).with('hostname.com/action_caching_test', :expires_in =&gt; 1.hour).once
+    @controller.expects(:write_fragment).with('hostname.com/action_caching_test', '12345.0', :expires_in =&gt; 1.hour).once
+    get :index
+  end
+
   def test_action_cache_with_custom_cache_path
     get :show
     cached_time = content_to_cache</diff>
      <filename>actionpack/test/controller/caching_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>87fbcaa6229e9073095fb8d77c7a536c9466fbce</id>
    </parent>
  </parents>
  <author>
    <name>josevalim</name>
    <email>jose.valim@gmail.com</email>
  </author>
  <url>http://github.com/rails/rails/commit/bad1eac91d1549631dca8e93e7e846911649acf7</url>
  <id>bad1eac91d1549631dca8e93e7e846911649acf7</id>
  <committed-date>2008-07-03T18:00:51-07:00</committed-date>
  <authored-date>2008-06-14T01:45:32-07:00</authored-date>
  <message>Allow caches_action to accept cache store options. [#416 state:resolved]

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>2ee30ac1ac7451d9a0a40c02481d13f74f3fc9d4</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
