PHP code example of openclassrooms / doctrine-cache-extension
1. Go to this page and download the library: Download openclassrooms/doctrine-cache-extension library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
openclassrooms / doctrine-cache-extension example snippets
OpenClassrooms\DoctrineCacheExtension\CacheProviderDecorator;
//do things
$cacheProvider = new ArrayCache();
$cacheProviderDecorator = new CacheProviderDecorator($cacheProvider);
$factory = new CacheProviderDecoratorFactory();
$cacheProvider = $factory->create('array');
$cacheProviderDecorator = new CacheProviderDecorator($cacheProvider, 100);
$cacheProviderDecorator->save($id, $data);
$cacheProvider = $factory->create('array', 100);
$factory = new CacheProviderDecoratorFactory();
$factory->setDefaultLifetime(100);
$data = $cacheProviderDecorator->fetchWithNamespace($id, $namespaceId);
// Namespace and life time can be null
$data = $cacheProviderDecorator->saveWithNamespace($id, $data, $namespaceId, $lifeTime);
$cacheProviderDecorator->invalidate($namespaceId);