You are browsing a version that is no longer maintained. |
Usage
First, configure your cache providers under the doctrine_cache configuration
option. Example:
# app/config/config.ymldoctrine_cache: providers: my_apc_metadata_cache: type: apc namespace: metadata_cache_ns my_apc_query_cache: namespace: query_cache_ns apc: ~
Then, use the newly created doctrine_cache.providers.{provider_name} container
services anywhere in your application:
$metadataCache = $this->container->get('doctrine_cache.providers.my_apc_metadata_cache');
$queryCache = $this->container->get('doctrine_cache.providers.my_apc_query_cache');
Service Aliases
In order to make your code more concise, you can define aliases for these services
thanks to the aliases configuration option. Example:
# app/config/config.ymldoctrine_cache: aliases: apc_cache: my_apc_cache providers: my_apc_cache: type: apc namespace: my_apc_cache_ns aliases: - apc_cache
Now you can use the short apc_cache alias to get the provider called
my_apc_cache, instead of using doctrine_cache.providers.my_apc_cache:
$apcCache = $this->container->get('apc_cache');
