2017 © Pedro Peláez
 

library yii-doctrine-cache

Doctrine Cache Factory for Yii 1

image

kozz/yii-doctrine-cache

Doctrine Cache Factory for Yii 1

  • Saturday, January 31, 2015
  • by urakozz
  • Repository
  • 2 Watchers
  • 1 Stars
  • 4,992 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Yii1 Doctrine Cache

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version Latest Unstable Version License, (*1)

Proxy for Doctrine Cache in Yii, (*2)

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

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

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

Advantages

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


//SomeFile.php use Kozz\Yii1\Cache\YiiDoctrineCache; $cache = new YiiDoctrineCache(); $cache->save('id', 'value'); //SomeOtherFile.php use Kozz\Yii1\Cache\YiiDoctrineCache; $cache = new YiiDoctrineCache(); $cache->fetch('id'); // 'value'

Reference

Methods, (*6)

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

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

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

delete($id) - Deletes a cache entry, (*10)

The Versions