PHP code example of peloncano / cakephp-plugin-redis-cache
1. Go to this page and download the library: Download peloncano/cakephp-plugin-redis-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/ */
peloncano / cakephp-plugin-redis-cache example snippets
$config['RedisCache'] = array(
'cache' => array(
'scheme' => 'tls',
'ssl' => ['verify_peer' => false], // any other predis SSL related options here
'host' => 'localhost',
'password' => '',
'port' => 6379, // could be different for tls connections
'database' => 0
)
);
Cache::config('default', array('engine' => 'RedisCache.Redis'));
// with prefix and duration
Cache::config('other_cache_with_prefix', array(
'engine' => 'RedisCache.Redis',
'prefix' => 'other_cache_with_prefix',
'duration'=> '+1 week'
));
// `throwExceptions` set to TRUE will throw exceptions on redis connection issues
// by default this is FALSE which will allow the app to continue working if caching fails
// due to redis/predis connection issues
Cache::config('other_cache', array(
'engine' => 'RedisCache.Redis',
'throwExceptions' => true
));