Doctrine Cache Factory for Yii 1

1.0.0 2015-01-31 16:22 UTC

This package is not auto-updated.

Last update: 2022-05-14 03:46:56 UTC


Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version Latest Unstable Version License

Proxy for Doctrine Cache in Yii

When to use

YiiDoctrineCache implements Doctrine\Common\Cache\Cache interface so it's fully compatible with all libraries that are requiring Doctrine Cache such as:

  • Doctrine Annotation Reader
  • Symfony Validator
  • JMS Serializer

How does it works

YiiDoctrineCache loads the most suitable Doctrine Cache Implementation in dependency of Yii Cache configuration:

  • Doctrine\Common\Cache\MemcachedCache
  • Doctrine\Common\Cache\MemcacheCache
  • Doctrine\Common\Cache\ArrayCache


YiiDoctrineCache uses Proxy design pattern under the hood so you always have the same instance of Cache every time you call new YiiDoctrineCache() even if Doctrine's ArrayCache selected

use Kozz\Yii1\Cache\YiiDoctrineCache;

$cache = new YiiDoctrineCache();
$cache->save('id', 'value');

use Kozz\Yii1\Cache\YiiDoctrineCache;

$cache = new YiiDoctrineCache();
$cache->fetch('id'); // 'value'



fetch($id) - Fetches an entry from the cache

contains($id) - Test if an entry exists in the cache

save($id, $data, $lifeTime = false) - Puts data into the cache

delete($id) - Deletes a cache entry