PHP code example of gueff / cachix

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

    

gueff / cachix example snippets



// init Config
\Cachix::init(array(
    'bCaching' => true,
	'sCacheDir' => '/tmp/',
	'iDeleteAfterMinutes' => 10,
	'sBinRemove' => '/bin/rm',
	'sBinFind' => '/usr/bin/find',
	'sBinGrep' => '/bin/grep'
));

// build a Cache-Key
$sKey = 'myCacheKey.Token';

// autodelete cachefiles
// which contain the string ".Token" in key-names
\Cachix::autoDeleteCache('.Token');

// first time saving data to cache...
if (empty(\Cachix::getCache($sKey)))
{
    // Data to be cached
    $aData = ['foo' => 'bar'];
    
    \Cachix::saveCache(
       	$sKey,
     	$aData
    );