首先第一步需要安装memcached扩展

ci框架memcached使用-LMLPHP

安装方法这里就不叙述了

application/config/memcached.php配置

$config = array(
'default' => array(
'hostname' => '127.0.0.1',
'port' => '10000',
'weight' => '1',
),
);
开启memcached 端口10000
使用:
$this->load->driver('cache');

$this->cache->memcached->save('test','test',300);

$this->cache->memcached->get('test');
ci框架手册
https://codeigniter.org.cn/user_guide/libraries/caching.html#memcached
05-08 15:23