2017 © Pedro Peláez
 

library annotated-cache-bundle

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

image

phpro/annotated-cache-bundle

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

  • Monday, May 9, 2016
  • by phpro
  • Repository
  • 5 Watchers
  • 4 Stars
  • 3,786 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 16 % Grown

The README.md

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., (*1)

Build status Insight Installs Packagist, (*2)

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., (*3)

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., (*4)

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., (*5)

The Versions