Rails action_cache plugin update

The action_cache plugin has just been updated. I’ve added the Cache-Control: max-age=x header, where x is the number of seconds set in the time_to_live parameter on the response object.

This setting will encourage the browser to cache the response for the amount of time the programmer has decided is Ok for potentially stale data to be cached.

Install the plugin from http://craz8.com/svn/trunk/plugins/action_cache

This entry was posted on Fri, 08 Dec 2006 06:20:44 GMT . You can follow any any response to this entry through the Atom feed. You can leave a comment .
Tags


Comments

Leave a response

  1. Mark Suppes 6 days later:

    Hey Tom! How are you?

    You say:

    The Action Cache replacement plugin allows this (cached url query strings) and more, e.g. the ability to cache based on cookie values.

    How do I cache url query strings with your plugin? Can’t find any examples.

    Thanks for your time!

    Mark Suppes Director of Technology Critical Metrics

  2. Tom 7 days later:

    I sent you an email with an example of how to do this.

    I’ll also put a post together with a more realistic example, probably over the weekend

  3. DEkart 14 days later:

    Thank you for this great plugin. I have observed improper behavior when expiring index action.

    I connect some controller to my home page:

    map.connect '', :controller => "index"

    then i setup my IndexController to cache the index action with

    caches_action :index

    it caches the result to RAILS_ROOT/tmp/cache/META/mydomain.com/.cache

    then when i’m trying to expire index action:

    expire_action :controller => "index", :action => "index"

    then some strange thing happens – the plugin clears cache for all controllers and actions without any exclusions.

    Is there any solution to expire only index page?

  4. Tom 15 days later:

    This could be a bug. I’m using regular expressions to expire the actions, and this may be a little aggressive.

    I would have expected the cached action to be in META/mydomain.com/index/index.cache, but it seems my default action_fragment_key method would give this result.

    I check it out and issue a fix in the next week or so.

  5. arjen 10 months later:

    Hi,

    First of all thanks for the plugin, it works beautifully.

    Any progress on expiring just the homepage as previously mentioned by DEkart? Expiring the homepage currently yields:

    Expired fragments matching: ./localhost-3000/.

    which pretty muches flushes everything. :)

  6. tom 11 months later:

    Using the key override method in your controller, you can change the key the cache uses for the home page to something like localhost-3000/controller/action_name. Then when you expire it, it won’t wipe out the whole cache.

    I’ve spent some time working with the action cache recently, and I don’t really like the expiry mechanism I’m using. It doesn’t work at all if you use memcache for your fragment cache, and it scans a whole bunch of files if your fragment cache is the file system.

  7. Jesse about 1 year later:

    Hi, Tom,

    I have the same question with Mark Suppes, but you sent email to him , so i can not find the solution to fix my problem, may i have your email for this?

    -------

    The Action Cache replacement plugin allows this (cached url query strings) and more, e.g. the ability to cache based on cookie values.

    How do I cache url query strings with your plugin? Can’t find any examples.

    Thanks for your time!

Leave a comment