This repository has been archived since we are not using it anymore internally. Feel free to use it AS-IS, we won't be providing any support anymore.
composer require phpro/annotated-cache-bundle
# AppKernel.php
public function registerBundles()
{
$bundles = [
// Bundles ....
new Phpro\AnnotatedCacheBundle\AnnotatedCacheBundle(),
];
return $bundles;
}
Note: If you want to use cached services with multiple tags, it's recommended to register this bundle as early as possible.
# Default configuration for extension with alias: "annotated_cache"
annotated_cache:
key_generator: phpro.annotated_cache.keygenerator.expressions
proxy_config:
cache_dir: '%kernel.cache_dir%/annotated_cache'
namespace: AnnotatedCacheGeneratedProxy
register_autoloader: true
pools:
# Example:
poolname:
service: service.key
services:
app.manager.products:
class: App\Manager\ProductsManager
tags:
- { name: 'annotated_cache.eligable' }
You can register your own services to use a caching proxy instead.
The only thing you will have to do is to tag your service with the annotated_cache.eligable
tag.
services:
app.interceptor.my_interceptor:
class: App\Interceptor\MyInterceptor
tags:
- { name: 'annotated_cache.interceptor' }
Adding your own functionality is easy.
Create your own InterceptorInterface
and tag it with the annotated_cache.interceptor
tag.