PHP code example of g4 / mcache

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

    

g4 / mcache example snippets

 php

    
$driverName = 'Libmemcached';
$options = array(
    'servers' => array(
        '127.0.0.1:11211'
    );
);
$prefix = 'my_prefix';
    
$mcache = \G4\Mcache\McacheFactory::createInstance($driverName, $options, $prefix);
 php

    
$driverName = 'Couchbase';
$options = array(
    'bucket' => 'my_bucket',
    'servers' => array(
        '127.0.0.1:8091'
    );
);
$prefix = 'my_prefix';
    
$mcache = \G4\Mcache\McacheFactory::createInstance($driverName, $options, $prefix);