2016-11-20 43 views
0

我在使用MAMP在Codeigniter 3.1.2上測試memcached。我在我的phpinfo頁面上顯示了memcached(版本:2.2.0)

下面是我的代碼。

//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 
} 

下面返回的代碼:

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] => 
     ) 

) 

enter image description here

SSL安裝在new-app.dev。有人能告訴我我錯過了什麼嗎?

回答

0

看着uptimepid,它看起來像你沒有安裝memcache服務器或它沒有運行。內存緩存是不是MAMP的一部分,你需要安裝單獨

在Mac上安裝內存緩存服務器,只需運行 brew install memcached

內存緩存服務器Memcache的PHP驅動程序是兩個完全不同的東西

+0

我按照教程http://www.pavlatka.cz/2016/02/mac-osx-enable-memcached-on-mamp/在MAMP上安裝memcached。沒有提到memcached服務器。我也檢查了memcached的官方網站https://memcached.org並得到了同樣的結果。你能分享一些我可以閱讀的文件嗎?謝謝 – Lomse

+0

@Lomse補充說,在回答:) – georoot

+0

我得到了警告** memcached-1.4.33已經安裝** – Lomse

相關問題