1. Go to this page and download the library: Download snicco/better-wp-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/ */
snicco / better-wp-cache example snippets
use Snicco\Component\BetterWPCache\CacheFactory;
$cache_group = 'my_plugin';
$psr_6_cache = CacheFactory::psr6($cache_group);
use Snicco\Component\BetterWPCache\CacheFactory;
$cache_group = 'my_plugin';
$psr_16_cache = CacheFactory::psr16($cache_group);
use Snicco\Component\BetterWPCache\CacheFactory;
$cache = CacheFactory::taggable(CacheFactory::psr6('my_plugin'));
$item = $cache->getItem('tobias');
$item->set('value')->setTags(['tag0', 'tag1'])
$cache->save($item);
$item = $cache->getItem('aaron');
$item->set('value')->setTags(['tag0']);
$cache->save($item);
// Remove everything tagged with 'tag1'
$cache->invalidateTags(['tag1']);
$cache->getItem('tobias')->isHit(); // false
$cache->getItem('aaron')->isHit(); // true
$item = $cache->getItem('aaron');
echo $item->getPreviousTags(); // array('tag0')
// No tags will be saved again. This is the same as saving
// an item with no tags.
$cache->save($item);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.