简单修改,让CI支持memcache
CI默认只支持memcaced,今天在网上搜索了下,一些解决方案都是错的,经过ci源代码分析,给出一个正确的解决方案。1.复制driver目录下的memcachd.php为memcache.php.并且将memcached替换为memcache
2.修改CI_Cache类,给$valid_drivers增加一个“memcache"
3.在config目录下新加memcache.php,内容为:
<?php
$config['memcache'] = array(
'hostname' => '127.0.0.1',
'port' => 11211,
'weight' => 1
);
调用:$this->load->driver('cache', array('adapter' => 'memcache'));
$this->cache->save('lrj_test', "sss", 300);
echo "s:".$this->cache->get("lrj_test");exit;
页:
[1]