### Caching Techniques in Rails
* Page Caching
* Action Caching
* Fragment Caching (done by default in Rails)
* To play with caching in development mode (it is done automatically in production)
* change the setting in `config/environments/*.rb`
* `config.action_controller.perform_caching = true`
---
### Page Caching
* Rails mechanism which allows requests for a generated page to be loaded by the webserver without
having to go through the entire rails stack.
* Can't be applied to pages that have the `before_action` filters, therefor on pages with
authentication!
---
#### Action Caching
* Page caching cannot be used for actions that have before filters
* Action caching allows the stack to be hit and lets the filters run before serving the cache.
---
### Fragment Caching
* Different parts of the page can have different levels of caching characteristics
* Some may need to be expired before others
* Allows a fragment of **view logic** to be wrapped in a cache block and served out of the
cache store when the next request comes in.
```ruby
<% @products.each do |product| %>
<% cache product do %>
<%= render product %>
<% end %>
<% end %>
# Caching each product on a page
```