rka05
(Raghav Agarwal 05)
1
Hi All,
I was trying to use caching in my application.
I have added these lines in config.
‘cache’=>array(
'class'=>'CMemCache',
'useMemcached' => true,
'servers'=>array(
array('host'=>'127.0.0.1', 'port'=>11211, 'weight'=>60),
// array(‘host’=>‘server2’, ‘port’=>11211, ‘weight’=>40),
),
),
In the component section.
But I am getting error "CMemCache requires PHP memcached extension to be loaded"
But using this post as a reference,
http://www.yiiframework.com/forum/index.php/topic/35103-using-cmemcache-if-installed-on-server/
I have checked, that memcached extension is loaded.
Still I am getting this error.
Please help.
Thanks in advance.
rka05
(Raghav Agarwal 05)
2
The above problem is solved. It was aactually my mistake.
There are a difference in "memcache" and "memcached". In my system memcached was not installed.
But now I have a different problem.
$timeZones = Timezones::model()->findAll();
$timeZoneArray = array();
foreach ($timeZones as $time) {
$timeZoneArray[$time->id] = $time->timezone;
}
// now try caching
$id = "abcd";
$value = $timeZoneArray[10];
Yii::app()->cache->set($id, $value, 120);
$value = Yii::app()->cache->get($id);
echo "<pre>";
print_r($value);
die('qqq');
Finally $value is empty.
When I display Yii::app()->cache, I was not able to see the values which I set for cache.
Any help.