PHP code example of g4 / russian-doll

1. Go to this page and download the library: Download g4/russian-doll 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 / russian-doll example snippets




$mcache = \G4\Mcache\McacheFactory::createInstance($driverName, $options, $prefix);

$key = \G4\RussianDoll\Key('posts');
$key
    ->addVariablePart($perPage)
    ->addVariablePart($page);

$russianDoll = new \G4\RussianDoll\RussianDoll($mcache);
$russianDoll->setKey($key);

// get data from cache
$posts = $russianDoll->fetch();

// write data to cache
$russianDoll->write($posts);

// invalidate cache entry
$russianDoll->expire();