zodyac/cache

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

Caching library with support for multiple cache backends

v0.1.2 2013-09-13 12:43 UTC

This package is not auto-updated.

Last update: 2021-04-11 21:57:39 UTC


README

Caching library with a unified interface for multiple backends

Latest Stable Version Build Status

Usage

use Zodyac\Cache\Cache;
use Zodyac\Cache\Storage\ApcStorage;

$cache = new Cache(new ApcStorage());
$result = $cache->get('key');
if ($result->isMiss()) {
    $value = expensiveOperation(42);
    $cache->set('key', $value);
}

Backends

Memcached

APC

Doctrine cache bridge

Use the your Zodyac\Cache\Cache instance as a Doctrine Cache with Zodyac\Cache\DoctrineCache. This is useful when you want to use Zodyac Cache for metadata, query or result caching in Doctrine ORM.

use Zodyac\Cache\Cache;
use Zodyac\Cache\DoctrineCache;
use Zodyac\Cache\Storage\ApcStorage;

$cache = new Cache(new ApcStorage());
$doctrineCache = new DoctrineCache($cache);
$value = $doctrineCache->doFetch('key');

Credits