PHP code example of philippwitzmann / cache

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

    

philippwitzmann / cache example snippets


$dateTimeHandler = new DateTimeHandler();
$arrayCache      = new ArrayCache($dateTimeHandler);

$client = new Client([
    'scheme' => 'tcp',
    'host'   => '127.0.0.1',
    'port'   => 6379,
]);
$dateTimeHandler = new DateTimeHandler();
$arrayCache      = new ArrayCache($dateTimeHandler);
$redisCache      = new RedisCache($dateTimeHandler, $client);
$arrayCache->set('key', 'value', 600); // 600 is Lifetime In Seconds so 10Minutes.
$redisCache->set('key', 'value', 600); // 600 is Lifetime In Seconds so 10Minutes.

echo $arrayCache->get('key'); // Outputs: 'value'
bash
php vendor/bin/phpunit --configuration config/phpunit.xml