1. Go to this page and download the library: Download seanja/cacheable-trait 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/ */
seanja / cacheable-trait example snippets
class Controller
{
use SeanJA\Cache\CacheableTrait;
public function __construct(CacheItemPoolInterface $cache)
{
$this->setCache($cache);
}
}
public function cacheableMethod( $cacheable_parameters )
{
$data = $this->remember(function(){
return 'Cacheable data';
});
return response($data);
}
public function shouldDisableCaching(): void
{
$this->disableCache();
}
class CachedClass{
use \SeanJA\Cache\CacheableTrait;
public function cachedTime(){
return $this->remember(function(){
return time();
});
}
public function uncachedTime(): void
{
$this->disableCache();
$data = $this->cachedTime();
$this->restoreCache();
return $data;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.