edDoctrineCacheResultPlugin - 0.0.2

Manage cache doctrine result

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

edDoctrineCache plugin

The edDoctrineCacheResult plugin lets you easily manage the instantiation and the invalidation of cached Doctrine queries result.

Installation

symfony plugin-install http://plugins.symfony-project.com/edDoctrineCacheResult

Configuration

  • In app/config/app.yml add

ed_doctrine_cache_result: enable: true

Example

1: Cache Doctrine query result for all articles from one company. $query = Doctrine_Query::create() ->from('Article a') ->innerJoin('a.Company b WITH b.id = ?', $company_id);

$cacheResult = new edDoctrineCacheResult( $query, array('company', $company_id, 'articles'), new Doctrine_Cache_Apc());
$result = $cacheResult->fetchArray();
or
$result = $cacheResult->fetchOne();
or
$result = $cacheResult->execute();

2: Invalid cache result $storage = new edDoctrineCacheStorage(array('company', $company_id, 'articles'), null, new Doctrine_Cache_Apc()); $storage->clearResults();

3: Invalid all cache results for a company $storage = new edDoctrineCacheStorage(array('company', $company_id), null, new Doctrine_Cache_Apc()); $storage->clearResults();