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.turbo.cache.content' => [
        'type' => 'adredis',
        'host' => function() { return env('REDIS_HOST'); },
        'port' => function() { return env('REDIS_PORT'); },
        // 'database' => function() { return env('REDIS_DATABASE'); },
        // 'password' => function() { return env('REDIS_PASSWORD'); },
    ],
];


return [
    'otherVendor.pluginName.cache' => ['type' => 'adredis', /*...*/],
    
    // like
    'bnomei.fingerprint.cache' => ['type' => 'adredis', /*...*/],
    'bnomei.lapse.cache' => ['type' => 'adredis', /*...*/],
    'bnomei.turbo.cache.cmd' => ['type' => 'adredis', /*...*/],
    'bnomei.turbo.cache.model' => ['type' => 'adredis', /*...*/],
    
    // (optional) use a fast cache for Kirby's uuids
    'cache' => [
        'uuid' => ['type' => 'adredis', /*...*/],
    ],
    
    //... other options
];

$redis = \Bnomei\Redis::singleton();
$redis->set('key', 'value', $expireInMinutes);
$value = $redis->get('key', $default);
$redis->remove('key');
$redis->flushstore(); // data in memory
$redis->flush(); // memory and prefixed values
$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);