【问题标题】:Codeigniter $this->cache->memcached->save('foo', 'bar', 600) returns falseCodeigniter $this->cache->memcached->save('foo', 'bar', 600) 返回 false
【发布时间】:2017-04-03 15:11:26
【问题描述】:

我正在使用 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] => 
        )

)

SSL 安装在 new-app.dev 上。有人可以告诉我我缺少什么吗?

【问题讨论】:

    标签: php codeigniter caching memcached


    【解决方案1】:

    查看uptimepid,您似乎没有安装memcache 服务器或者它没有运行。 Memcache 不是MAMP 的一部分,您需要单独安装它

    要在 mac 上安装 Memcache 服务器,只需运行 brew install memcached

    Memcache serverMemcache php Drivers 是两个完全不同的东西

    【讨论】:

    猜你喜欢
    • 2014-12-07
    • 2019-03-10
    • 1970-01-01
    • 1970-01-01
    • 2021-09-05
    • 1970-01-01
    • 2022-11-04
    • 1970-01-01
    • 2015-04-22
    相关资源
    最近更新 更多