2017 © Pedro Peláez
 

symfony-bundle doctrine-cache-invalidator-bundle

Invalidate easily your doctrine cache

image

easytek/doctrine-cache-invalidator-bundle

Invalidate easily your doctrine cache

  • Wednesday, June 8, 2016
  • by jcrombez
  • Repository
  • 1 Watchers
  • 0 Stars
  • 276 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

DoctrineCacheInvalidationBundle

Invalidate your doctrine cache easily., (*1)

This bundle is still a work in progress., (*2)

ToDo

  • Define the invalidations rules in the bundle configuration instead of a class ?
  • Add some tests.
  • Add Doctrine 2.3 wildcard invalidation syntax.

Install

composer require "easytek/doctrine-cache-invalidator-bundle" "dev-master"

Use

Create this service :, (*3)

<?php

namespace You\YourBundle\Cache;

use Easytek\DoctrineCacheInvalidatorBundle\Cache\CacheInvalidationInterface;

class CacheInvalidation implements CacheInvalidationInterface
{
    public function getClasses()
    {
        retun array();
    }
}

Then you add it in your services file configuration :, (*4)

    you.yourbundle.cache_invalidation:
        class: You\YourBundle\Cache\CacheInvalidation
        tags:
            - { name: easytek.doctrine_cache_invalidation }

Then you have to fill the array returned by the getClasses method of your service. The array contains a key for each doctrine entity class you want to work on. This key is associated with an array of invalidation rules, each invalidation rule is also an array, containing the two following informations :, (*5)

  • The cache id pattern, which can contain {attribute}, the same way you do in Twig.
  • The entity changes triggering the invalidation, it can be "insert", "update", "delete" or "*" wich regroup the first three.

Example :, (*6)

// ...
    public function getClasses()
    {
        return array(
            'You\YourBundle\Entity\Category' => array(
                array(
                    'pattern' => 'category_{id}',
                    'changes' => array('*')
                )
            )
        )
    }

This means, when a Category entity will be either inserted, updated or deleted, the cache id 'category_{id}' (where {id} is replaced by $category->getId()) will be cleared., (*7)

The Versions

08/06 2016

dev-master

9999999-dev

Invalidate easily your doctrine cache

  Sources   Download

MIT

The Requires

 

cache doctrine invalidation

19/09 2013

v0.1

0.1.0.0

Invalidate easily your doctrine cache

  Sources   Download

MIT

The Requires

 

cache doctrine invalidation