1. Go to this page and download the library: Download imag/simple-cache-bundle 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/ */
imag / simple-cache-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new IMAG\LdapBundle\IMAGSimpleCacheBundle(),
);
}
php
public function __construct(\IMAG\SimpleCacheBundle\Manager\CacheManager $cache)
{
$this->cache = $cache;
}
public function getArchiveOfAppsPdf(array $applications)
{
$key = md5(serialize($applications));
$this->cache->setReferenceKey($key);
// Because setReference have been called, this reference is searched with the key $key
if ($cached = $this->cache->getReference()) {
return $cached;
}
$zip = $this->zip->getZip();
// Because setReference have been called, this method use $key to store the $zip reference
$this->cache->addReference($zip);
return $zip;
}
public function getExample(array $applications)
{
$zip = $this->getZip($applications);
// This reference is searched under md5(serialize($zip))
if ($cached = $this->cache->getReference($zip)) {
return $cached;
}
// This reference is stored under md5(serialize($zip))
$this->cache->addReference($zip);
return $zip;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.