<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
angelxmoreno / cakephp-simplecache-bridge example snippets
Cache::config('short', [
'className' => 'File',
'duration' => '+1 hours',
'path' => CACHE,
'prefix' => 'cake_short_'
]);
$cache = new Bridge('short');
//setting cache data
$cache->set('some_key', 'some value');
//getting cache data with a default
$value = $cache->get('some_key', 'some default');
//overriding the Cache engine's TTL with an int
$cache->set('some_key', 'some value', 300); //cached for 300 seconds instead of `+1 hours`
//overriding the Cache engine's TTL with a `\DateTimeInterval` ( as per the SimpleCache Interface )
$interval = new \DateTimeInterval('P1Y'); // an interval of 1 year
$cache->set('some_key', 'some value', $interval); //cached for 1 year instead of `+1 hours`