Agile Web Development

Build it. Launch it. Love it.

Conditional Caching

ConditionalCache

==========

Read a tutorial for this plugin at http://weblog.redlinesoftware.com/2007/11/26/conditional-cache-plugin-tutorial


Updates

Oct. 31, 2008 DEPRECATING plugin The :cache_path option can essentially replace the :tag option.

The following changes can be made to use the :cache_path option instead of the :tag option.

1) Change all instances of :tag to :cache_path 2) If the :tag referred to a sybmol such as :tag => :standard_tag, you simply need to change the method name that the symbol refers to as standard_tag_url (just add _url to the end of the method name). 3) The host name no longer prefixes the cache fragment when :cache_path uses anything other than a hash, so make sure to begin your cache_path with the string generated from "request.url" (includes protocol) or "request.host + request.request_uri" (no protocol) if your cache fragment keys depend on the host name.

Jul. 02, 2008 Updated to work with rails 2.1 Removed the :if option since Rails now provides this functionality.

Dec. 13, 2007 Updated to work with rails 2.0.1

Oct. 12, 2007 Updated to work with rails 1.2.4


Provides additional options for the caches_action method.

:tag - Specifies a method, proc or string to call in order to add an additional tag to the cache fragment so that various states of caching can occur within the application. The method, proc or string should return or evaluate to a string. The tag (string) is appended to the end of the cache key so use expire_fragment with a regex to safely expire actions that use the :tag option.

e.g.) :tag => Proc.new { |controller| controller.user_type.to_s } # This will cache the page dependant on the type of user logged in.

Vitals

Home http://www.redlinesoftware.com
Repository http://svn.redlinesoftware.com/plugins/conditional_cache
License Rails' (MIT)
Tags Tag_red caches_action caching conditional
Rating (8 votes)
Owner Redline Software Inc.
Created 24 May 2006

Comments

  • Artem
    2 July 2008

    Please, update it to rails 2.1

Add a comment