I'm testing memcached on Codeigniter 3.1.2 using MAMP. I have memcached showing on my phpinfo page (version: 2.2.0)
Below is my code.
//In the /Application/config/memcached.php file
$config = array(
'default' => array(
'hostname' => 'new-app.dev',
'port' => '11211',
'weight' => '1',
),
);
.
public function test_caching() {
$this->load->driver('cache');
var_dump($this->cache->memcached->save('foo', 'bar', 600)); // Returns false
}
The code below returns:
echo '<pre>';
print_r($this->cache->memcached->cache_info());
Array
(
[new-app.dev:11211] => Array
(
[pid] => -1
[uptime] => 0
[threads] => 0
[time] => 0
[pointer_size] => 0
[rusage_user_seconds] => 0
[rusage_user_microseconds] => 0
[rusage_system_seconds] => 0
[rusage_system_microseconds] => 0
[curr_items] => 0
[total_items] => 0
[limit_maxbytes] => 0
[curr_connections] => 0
[total_connections] => 0
[connection_structures] => 0
[bytes] => 0
[cmd_get] => 0
[cmd_set] => 0
[get_hits] => 0
[get_misses] => 0
[evictions] => 0
[bytes_read] => 0
[bytes_written] => 0
[version] =>
)
)
SSL is installed on new-app.dev. Could someone please tell me what I'm missing?
Looking at uptime
and pid
, it looks like you did not install memcache
server or it is not running. Memcache is not a part of MAMP
you need to install that separately
To install Memcache server on mac simply run brew install memcached
Memcache server and Memcache php Drivers are two entirely separate things