PHP code example of netzdenke / phpmcached

1. Go to this page and download the library: Download netzdenke/phpmcached 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/ */

    

netzdenke / phpmcached example snippets




$cache = \PHPMCached\PHPMCached::getInstance('application_name');
$cache->addServer('127.0.0.1');
$cacheKey = $cache->getCacheKey('foo');

$cache->set($cacheKey, 'value', 'cache_group', \PHPMCached\PHPMCached::EXPIRATION_HOUR);

$value = $cache->get($cacheKey);

$cache->deleteCacheGroup('cache_group');