CI reids 缓存

注意:在项目中的application/libraries 中自己定义的类最好不要以cache命名。

连接 Redis 服务器的配置信息必须保存到 application/config/redis.php 文件中(没有就新建一个)

$config['socket_type'] = 'tcp'; //`tcp` or `unix`;
$config['socket'] = '/var/run/redis.sock'; // in case of `unix` socket type
$config['host'] = '127.0.0.1';
$config['password'] = NULL;
$config['port'] = 6379;
$config['timeout'] = 0;

加载redis

$this->load->driver('cache');
$this->cache->redis->save('foo', 'bar', 10);
原文地址:https://www.cnblogs.com/aajonas/p/5454134.html