phpro/annotated-cache-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Provides a Symfony bridge for the phpro/annotated-cache package

v0.1.2 2016-05-09 07:27 UTC

This package is auto-updated.

Last update: 2020-12-22 10:24:05 UTC


README

Repository abandoned 2020-11-27

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.

Build status Insight Installs Packagist

Annotated Cache bundle

Installation

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.

Configuration

# 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

Generate proxies

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.

Configure your own interceptor

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.