aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/doc/guides/source/caching_with_rails.txt34
1 files changed, 17 insertions, 17 deletions
diff --git a/railties/doc/guides/source/caching_with_rails.txt b/railties/doc/guides/source/caching_with_rails.txt
index e680b79d55..7a4074570e 100644
--- a/railties/doc/guides/source/caching_with_rails.txt
+++ b/railties/doc/guides/source/caching_with_rails.txt
@@ -10,8 +10,8 @@ need to return to those hungry web clients in the shortest time possible.
This is an introduction to the three types of caching techniques that Rails
provides by default without the use of any third party plugins.
-To get started make sure config.action_controller.perform_caching is set
-to true for your environment. This flag is normally set in the
+To get started make sure `config.action_controller.perform_caching` is set
+to `true` for your environment. This flag is normally set in the
corresponding config/environments/*.rb and caching is disabled by default
there for development and test, and enabled for production.
@@ -45,21 +45,21 @@ end
-----------------------------------------------------
The first time anyone requests products/index, Rails will generate a file
-called index.html and the webserver will then look for that file before it
+called `index.html` and the webserver will then look for that file before it
passes the next request for products/index to your Rails application.
By default, the page cache directory is set to Rails.public_path (which is
-usually set to RAILS_ROOT + "/public") and this can be configured by
-changing the configuration setting ActionController::Base.page_cache_directory. Changing the
-default from /public helps avoid naming conflicts, since you may want to
-put other static html in /public, but changing this will require web
-server reconfiguration to let the web server know where to serve the
-cached files from.
-
-The Page Caching mechanism will automatically add a .html exxtension to
+usually set to `RAILS_ROOT + "/public"`) and this can be configured by
+changing the configuration setting `config.action_controller.page_cache_directory`.
+Changing the default from /public helps avoid naming conflicts, since you may
+want to put other static html in /public, but changing this will require web
+server reconfiguration to let the web server know where to serve the cached
+files from.
+
+The Page Caching mechanism will automatically add a `.html` exxtension to
requests for pages that do not have an extension to make it easy for the
webserver to find those pages and this can be configured by changing the
-configuration setting ActionController::Base.page_cache_extension.
+configuration setting `config.action_controller.page_cache_extension`.
In order to expire this page when a new product is added we could extend our
example controler like this:
@@ -119,8 +119,8 @@ class ProductsController < ActionController
end
-----------------------------------------------------
-And you can also use :if (or :unless) to pass a Proc that specifies when the
-action should be cached. Also, you can use :layout => false to cache without
+And you can also use `:if` (or `:unless`) to pass a Proc that specifies when the
+action should be cached. Also, you can use `:layout => false` to cache without
layout so that dynamic information in the layout such as logged in user info
or the number of items in the cart can be left uncached. This feature is
available as of Rails 2.2.
@@ -164,7 +164,7 @@ could use this piece of code:
The cache block in our example will bind to the action that called it and is
written out to the same place as the Action Cache, which means that if you
-want to cache multiple fragments per action, you should provide an action_suffix to the cache call:
+want to cache multiple fragments per action, you should provide an `action_suffix` to the cache call:
[source, ruby]
-----------------------------------------------------
@@ -172,7 +172,7 @@ want to cache multiple fragments per action, you should provide an action_suffix
All available products:
-----------------------------------------------------
-and you can expire it using the expire_fragment method, like so:
+and you can expire it using the `expire_fragment` method, like so:
[source, ruby]
-----------------------------------------------------
@@ -185,7 +185,7 @@ expire_fragment(:controller => 'producst', :action => 'recent', :action_suffix =
Cache sweeping is a mechanism which allows you to get around having a ton of
expire_{page,action,fragment} calls in your code by moving all the work
-required to expire cached content into a ActionController::Caching::Sweeper
+required to expire cached content into a `ActionController::Caching::Sweeper`
class that is an Observer and looks for changes to an object via callbacks,
and when a change occurs it expires the caches associated with that object n
an around or after filter.