-
-
Notifications
You must be signed in to change notification settings - Fork 452
[V6˖] Psr16 adapter
Georges.L edited this page Feb 23, 2022
·
4 revisions
As of the V6 an helper is now available to allow you to make use of the Psr16 adapter.
/**
*
* This file is part of Phpfastcache.
*
* @license MIT License (MIT)
*
* For full copyright and license information, please see the docs/CREDITS.txt and LICENCE files.
*
* @author Georges.L (Geolim4) <contact@geolim4.com>
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
*/
use Phpfastcache\Helper\Psr16Adapter;
chdir(__DIR__);
require_once __DIR__ . '/../vendor/autoload.php';
$defaultDriver = (!empty($argv[1]) ? ucfirst($argv[1]) : 'Files');
$Psr16Adapter = new Psr16Adapter($defaultDriver, [/* Config array */]);
if(!$Psr16Adapter->has('test-key')){
$nastyStuff = 'Database/webservice/etc operations';
$Psr16Adapter->set('test-key', $nastyStuff);
}else{
$value = $Psr16Adapter->get('test-key');
}
❓ Finally, if you need help, always check out the inevitable README.md