Usage

First, configure your cache providers under the doctrine_cache configuration option. Example:

1# app/config/config.yml doctrine_cache: providers: my_apc_metadata_cache: type: apc namespace: metadata_cache_ns my_apc_query_cache: namespace: query_cache_ns apc: ~
2
3
4
5
6
7
8
9

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:

1# app/config/config.yml doctrine_cache: aliases: apc_cache: my_apc_cache providers: my_apc_cache: type: apc namespace: my_apc_cache_ns aliases: - apc_cache
2
3
4
5
6
7
8
9
10
11

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');