1.创建配置redis配置文件:application/config/redis.php
$config['socket_type'] = 'tcp'; //`tcp` or `unix` $config['host'] = '127.0.0.1'; $config['password'] = NULL; $config['port'] = 6379; $config['timeout'] = 0;
2.在控制器中即可使用
$this->load->driver(‘cache’);
$aaa = $this->cache->redis->get(‘aaa’);
$this->cache->redis->del(‘aaa’);
$this->cache->redis->save(‘aaa’,’ceshi’,10);
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/222021.html原文链接:https://javaforall.net
