CodeIgniter → Работа с memcache

При попытке использовать memcache в CodeIgniter 2:

$this->load->driver('cache');
$this->cache->memcached->save('var_name', 'var_value', 60);
echo $this->cache->memcached->get('var_name');

Возникает ошибка:

Invalid driver requested: Cache_memcache

Либо же нечто вроде:

Fatal error: Call to a member function add() on a non-object in
systemlibrariesCachedriversCache_memcached.php on line 67

Решение: правка ./system/libraries/Cache/drivers/Cache_memcached.php. Необходимо добавить конструктор:

function __construct() { 
    if(!$this->_memcached) { 
        $this->_memcached = new Memcache(); 
        $this->_memcached->connect('localhost', 11211); 
    } 
}

Если не возникло ошибок с подключением идем дальше.

В ache_memcached.php имеется еще одна ошибка в функции save():

public function save($id, $data, $ttl = 60) { 
    return $this->_memcached->add($id, array($data, time(), $ttl), $ttl); 
}

В следствие которой может возникнуть сообщение: Warning Message: MemcachePool::add() [memcachepool.add]: The lowest two bytes of the flags array is reserved for pecl/memcache internal use

Не буду вникать в подробности, при желании можно почитать тут. Все что необходимо сделать, добавить недостающий флаг:

public function save($id, $data, $ttl = 60) { 
    return $this->_memcached->add($id, array($data, time(), $ttl), MEMCACHE_COMPRESSED, $ttl); 
}

Должно работать :)Related: what page does boxer say i will work harder, jack falahee ellie satter, james temerty net worth, 24 hour bowling alley plymouth meeting, member’s mark fenton tv console, chris and rosella come dine with me, black summer bushfires timeline, lifestyle advanced led lights app, unity flats belfast map, oldest house in scarborough, 44 seals of solomon, can am ryker won’t start, how can i write to erik menendez, louisiana downs replays, gopher tortoise repellent,