1. Go to this page and download the library: Download mactronique/phpcache 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/ */
php
use Mactronique\PhpCache\Service\PhpCache;
use Mactronique\PhpCache\Driver\NullDriver;
class myService
{
private $cache
public function __construct(PhpCache $cache = null)
{
if (null === $cache) {
$cache = new PhpCache();
$cache->registerDriver(new NullDriver());
}
$this->cache = $cache;
}
public function myAction()
{
/*
You can use the cache but never key exist and all get return null.
*/
$val = $this->cache->get('key');
[...]
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.