[英]Using Memcached in CodeIgniter 3.0
Here is my model file; 这是我的模型文件;
function yaklasan_maclar_tenis() {
$data = $this->cache->memcached->get('yaklasan_tenis');
if (!$data){
$this -> db -> limit(10);
$data = array();
foreach ($this->db->get_where('maclar', array('durum' => '1', 'sonuclandi' => '0', 'tarih >=' => time(), 'spor' => '5'))->result_array() as $row) {
$data[] = array(
'id' => $row['id'],
'matchid' => $row['matchid'],
'spor' => $row['spor'],
'ulke' => $row['ulke'],
'turnuva' => $row['turnuva'],
'takim1' => $row['takim1'],
'takim2' => $row['takim2'],
'tarih' => $row['tarih'],
'istatistik' => $row['istatistik'],
);
}
$this->cache->memcached->save('yaklasan_tenis',$data, 600);
}
return $data;
}
I'm sure that I installed memcached properly but getting this error when I call this function: 我确定我已经正确安装了memcached,但是在调用此函数时收到此错误:
Fatal error: Call to a member function get() on a non-object in /home/mydomain/public_html/system/libraries/Cache/drivers/Cache_memcached.php on line 79
Here is the lines 77-82, Cache_memcached.php file: 这是第77-82行的Cache_memcached.php文件:
public function get($id)
{
$data = $this->_memcached->get($id); //this line is 79
return is_array($data) ? $data[0] : $data;
}
I made my research on site but couldn't find anything about it. 我在现场进行了研究,但找不到任何信息。 I just found something and tried the suggestion but nothing changed.
我只是发现了一些东西并尝试了建议,但没有任何改变。
Thanks in advance. 提前致谢。
Did you load the caching drive? 您是否加载了缓存驱动器?
Something likes: 喜欢的东西:
$this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.