PHP code example of bnomei / kirby3-redis-cachedriver

1. Go to this page and download the library: Download bnomei/kirby3-redis-cachedriver 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/ */

    

bnomei / kirby3-redis-cachedriver example snippets


return [
    'bnomei.boost.cache' => [
        'type' => 'redis',
        'host' => function() { return env('REDIS_HOST'); },
        'port' => function() { return env('REDIS_PORT'); },
        // 'database' => function() { return env('REDIS_DATABASE'); },
        // 'password' => function() { return env('REDIS_PASSWORD'); },
    ],
];
 

$redis = \Bnomei\Redis::singleton();
$redis->set('key', 'value', $expireInMinutes);
$value = $redis->get('key', $default);
$redis->remove('key');
$redis->flush(); // data in memory
$redis->flushdb(); // DANGER: flushes full redis db!!!

$redis = new \Bnomei\Redis($options, $optionsClient);
$client = $redis->redisClient();
$dbsize = $client->dbsize(); // https://bit.ly/2Z8YKyN

$redis = new \Bnomei\Redis($options, $optionsClient);
$redis->benchmark(1000);


return [
    'bnomei.lapse.cache' => ['type' => 'redis'],
    'bnomei.boost.cache' => ['type' => 'redis'],
    //... other options
];