lujscn 发表于 2013-8-8 17:48:28

CI2.1.4的Memcached真是坑爹啊!

本帖最后由 lujscn 于 2013-8-8 18:03 编辑

我的服务器已经配置好memcached, 调试了好几天都有问题,开始是memcached直接用不了,后来根据以下两个帖子改了:
http://codeigniter.org.cn/forums/thread-10071-1-1.html
http://codeigniter.org.cn/forums/thread-14066-1-1.html
改了之后是能用了,可是还不完善,
后来我下载了CI3,果然这个故障不再存在。

我的控制器代码是:

echo '-';
$this->load->driver('cache',array('adapter' => 'memcached', 'backup' => 'file') );
$this->cache->save('foo', 'bar', 10);
$x = $this->cache->get('foo');
echo $x;
               
if ($this->cache->memcached->is_supported())
{
          echo "-memcached yes!";
}
else echo "-memcached no!";
               
if ($this->cache->file->is_supported())
{
          echo "-file yes!";
}
else echo "-file no!";
               
echo '*<pre>';
print_r($this->cache->cache_info());
echo '</pre>';

在CI2.1.4下得到的结果是:

--memcached no!-file yes!*
Array
(
    => Array
      (
             => index.html
             => /data/web/wdocs/mai-hua_com/ci/application/cache/index.html
             => 114
             => 1375953133
             => application/cache/
      )

)

在config中增加migration.php故障依然。

在CI3得到的结果是:
-bar-memcached yes!-file yes!*
Array
(
    => 3978
    => 170984
    => 1375956200
    => 1.4.15
    => 1.4.13-stable
    => 64
    => 21.844679
    => 40.076907
    => 73
    => 396
    => 86
    => 20
    => 3326501
    => 226730
    => 0
    => 0
    => 3243606
    => 82895
    => 5278
    => 30341
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 182014672
    => 2305296578
    => 67108864
    => 1
    => 0
    => 4
    => 0
    => 16
    => 524288
    => 0
    => 8172876
    => 12318
    => 222150
    => 83
    => 0
    => 0
    => 142
)


CI2.1.4按上两个帖子改过以后的结果:
-bar-memcached yes!-file yes!*
Array
(
    => 3978
    => 170037
    => 1375955253
    => 1.4.15
    => 1.4.13-stable
    => 64
    => 21.298762
    => 39.035065
    => 72
    => 387
    => 86
    => 20
    => 3246496
    => 219476
    => 0
    => 0
    => 3165342
    => 81154
    => 5143
    => 29561
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 0
    => 177420773
    => 2250850753
    => 67108864
    => 1
    => 0
    => 4
    => 0
    => 16
    => 524288
    => 0
    => 8150443
    => 12274
    => 214898
    => 83
    => 0
    => 0
    => 141
)

看来CI3确实比CI2.1.4强,不知道正式版什么时候出来。

都想直接用dev版了!


dren_a 发表于 2013-8-9 01:35:32

建议自己写一些比较复杂的模块,CI在很多模块上都很坑爹的。。。

muneo 发表于 2013-8-9 09:40:10

http://h5b.net/memcache-php-helper/

cowa 发表于 2013-9-6 11:30:24

嗯 {:1_1:}{:1_1:}{:1_1:}{:1_1:}{:1_1:}{:1_1:}

Free❤Feng 发表于 2013-11-16 10:12:39

{:soso_e179:}{:soso_e179:}{:soso_e179:}{:soso_e179:}

konvn(老康) 发表于 2013-11-16 10:37:11

我就用了apc和file

rushui 发表于 2014-2-24 15:11:11

哪里有CI3啊?

乌索普 发表于 2015-8-7 15:47:52

学习了               
页: [1]
查看完整版本: CI2.1.4的Memcached真是坑爹啊!