yii memcache 在阿里云上的解决方法,查看下面的链接
主要是aliyun ocs 需要配置 username 和 password ,这个与yii常规 CMemCache 不太一样
[php] view plaincopy在CODE上查看代码片派生到我的代码片
$connect = new Memcached;
$connect->setOption(Memcached::OPT_COMPRESSION, false);
$connect->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
$connect->addServer('host', port);
$connect->setSaslAuthData('username', 'password');
$connect->set("hello", "world"); echo 'hello: ',$connect->get("hello");
$connect->quit();
我用以上代码,在服务器上能访问OCS
http://help.aliyun.com/view/11108324_13444498.html?spm=5176.7225337.1997284509.3.IEeHfl
https://github.com/aarondfrancis/yii-CMemCacheSASL
还有,上面的提示中有一点有误
'cache'=>array(
'class'=>'CMemCacheSASL',
'server'=> array(
'host'=>'host',
'port'=>11211,
'password'=>'xxxxxx',
'username'=>'xxxxxx'
),
),