1. Go to this page and download the library: Download webiny/cache 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/ */
webiny / cache example snippets
\Webiny\Components\ClassLoader::getInstance()->registerMap(['Jamm\Memory' => 'path to memory lib']);
// write to cache
$cache->save('myKey', 'some value', 600, ['tag1', 'tag2']);
// read from cache
$cache->read('myKey');
// delete from cache
$cache->delete('myKey');
// delete by tag
$cache->deleteByTag(['tag1']);
class MyClass
{
use \Webiny\Component\Cache\CacheTrait;
public function myMethod(){
$this->cache('Frontend')->read('cache_key');
}
}
class CustomCacheDriver implements \Webiny\Component\Cache\Bridge\CacheInterface
{
// implement the interface methods
// static method that will return the CacheDriver
function getDriver($cacheId, $param1, $param2, array $options){
$driver = new static($cacheId, $param1, $param2);
return \Webiny\Component\Cache\CacheDriver($driver, $options);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.