====== Symfony YAML Configuration Reference ======
=====The cache.yml configuration file=====
In this article we assume that you are familiar with [[http://www.symfony-project.org/reference/1_4/en/02-YAML|The YAML Format]] and [[http://www.symfony-project.org/reference/1_4/en/03-Configuration-Files-Principles|Configuration File Principles]].
The cache.yml configuration file describes the cache configuration for the view layer. This configuration file is only active if the //cache// setting is enabled in settings.yml.
When an application is created, symfony generates a default cache.yml file in the application //config/// directory which describes the cache for the whole application (under the //default// key). By default, the cache is globally disabled.
The default application configuration can be overridden for a module by creating a //cache.yml// file in the //config/// directory of the module.
action_name:
enabled:
with_layout:
lifetime: time_in_seconds
client_lifetime: time_in_seconds
contextual:
=====Cache configuration options=====
====action_name====
If //cache.yml// is in the //config/// directory of the module, then //action_name// key can specify one of the following:
* The action name without the //execute// prefix to determine if an action is cached or not;
* The //'All'// keyword for whole module;
* A partial or component by using its name prefixed with an underscore (_). The //with_layout// option is not taken into account for this type of cache as it does not make any sense.
If //cache.yml// is in the application //config/// directory which describes the cache for the whole application, //action_name// key must be set to //'default'//. Eg.:
default:
enabled: false
with_layout: false
lifetime: 86400
====action_name > enabled====
Enables or disables the cache for the current scope.
Possible values: ////
Default: //false//
====action_name > with_layout====
Determines whether the cache must be for the entire page (true), or for the action only (false).
Possible values: ////
Default: //false//
====action_name > lifetime====
Defines the server-side lifetime of the cache in seconds (86400 seconds equals one day).
Default: //86400//
====action_name > client_lifetime====
Defines the client-side lifetime of the cache in seconds.
This setting is used to automatically set the Expires header and the max-cache cache control variable, unless a Last-Modified or Expires header has already been set.
You can disable client-side caching by setting the value to 0.
Default: //Same value as the 'lifetime' one//
====action_name > contextual====
Determines if the cache depends on the current page context or not. The setting is therefore only meaningful when used for partials and components.
When a partial output is different depending on the template in which it is included, the partial is said to be contextual, and the //contextual// setting must be set to //true//. By default, the setting is set to //false//, which means that the output for partials and components are always the same, wherever it is included.
Possible values: ////
Default: //false//