PHP code example of rcastera / apc
1. Go to this page and download the library: Download rcastera/apc 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/ */
rcastera / apc example snippets
use rcastera\Apc\ApcCache;
use rcastera\Apc\ApcCache;
// Create a new object with properties to store in cache.
$object = new stdClass;
$object->name = 'Richard';
$object->age = 30;
// Store the object in cache.
ApcCache::store('rich', $object, 3600);
// Now check if it exists and fetch it.
if (ApcCache::exists('rich')) {
$person = ApcCache::fetch('rich');
}
// Output the name property value.
echo $person->name;
// Delete this specific key in cache.
ApcCache::delete('rich');
// Delete all cache.
ApcCache::clear();