dev-master
9999999-dev https://github.com/gueff/cachixA simple PHP Caching Class working with files
GPLv3 GPL-3.0-or-later
The Requires
- php >=7.0
by Guido K.B.W. Ueffing
file cache php caching php7
A simple PHP Caching Class working with files
A simple PHP Caching Class working with files, (*1)
rm
, find
and grep
to be executable via PHP's shell_exec
commandcreate the composer.json file with following content:, (*2)
{ "require": { "gueff/cachix":"1.0.2" } }
run installation, (*3)
$ composer install
<?php // 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 ); } // ...or read from existing Cache else { $aData = \Cachix::getCache($sKey); }
A simple PHP Caching Class working with files
GPLv3 GPL-3.0-or-later
file cache php caching php7