1. Go to this page and download the library: Download joefallon/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/ */
joefallon / phpcache example snippets
use JoeFallon\PhpCache\ApcCache;
use JoeFallon\PhpCache\TaggedCache;
$backing = new ApcCache();
$cache = new TaggedCache($backing); // default namespace and default expiration
$cache->store('user_45_profile', $profileData);
if ($cache->exists('user_45_profile')) {
$profile = $cache->retrieve('user_45_profile');
}
$cache->remove('user_45_profile');
use JoeFallon\PhpCache\ApcCache;
use JoeFallon\PhpCache\TaggedCache;
$cache = new TaggedCache(new ApcCache());
$cache->store('all_posts', $postsList, ['posts_table']);
$cache->store('post_45', $singlePost, ['posts_table']);
// Later, when posts are modified, invalidate everything tagged with 'posts_table':
$cache->removeByTag('posts_table');
$cacheA = new TaggedCache(new ApcCache(), 'siteA');
$cacheB = new TaggedCache(new ApcCache(), 'siteB');