twodevs / cache-interface
Provides an cache interface for several adapters
v1.0.0
2015-01-22 22:35 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- desarrolla2/cache: ~1.8
- doctrine/cache: ~1.4
- illuminate/cache: ~4.2
- phpunit/phpunit: 4.4.*
- zendframework/zend-cache: ~2.3
Suggests
- doctrine/cache: Allows to cache the response container
- zendframework/zend-cache: Allows to cache the response container
This package is auto-updated.
Last update: 2024-10-29 04:09:22 UTC
README
PHP interface library which provides an cache interface for several adapters.
Usage
1) Using the ArrayCache (Memory Cache)
// Using the array cache
$ws->setCache(new \TwoDevs\Cache\ArrayCache());
2) If doctrine cache is installed, it can be used to cache the result container using the doctrine cache adapter.
// Create a new DoctrineCache instance
$doctrineCache = new \Doctrine\Common\Cache\FilesystemCache('var/cache');
// Create a new DoctrineCache adapter
$cacheAdapter = new \TwoDevs\Cache\DoctrineCache($doctrineCache);
3) If zend cache is installed, it can be used to cache the result container using the zend cache adapter.
// Create a new ZendStorage instance
$zendCache = new \Zend\Cache\Storage\Adapter\Memory();
// Create a new ZendCache adapter
$cacheAdapter = new \TwoDevs\Cache\ZendCache($zendCache);