简体   繁体   English

如何在Windows的Wamp中启用memcached?

[英]how to enable memcached in wamp in windows?

Iam running WAMP server and just enabled php_memcache extension and have tried the code 我正在运行WAMP服务器,并且刚刚启用了php_memcache扩展,并尝试了代码

<?php
    $memcache = new Memcache;
    $memcache->connect('localhost', 11211) or die ("Could not connect");

    $version = $memcache->getVersion();
    echo "Server's version: ".$version."<br/>\n";

    $tmp_object = new stdClass;
    $tmp_object->str_attr = 'test';
    $tmp_object->int_attr = 123;

    $memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
    echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";

    $get_result = $memcache->get('key');
    echo "Data from the cache:<br/>\n";

    var_dump($get_result);
?>

It looks like you are trying to connect MySql server without installing it. 看来您正在尝试连接MySql服务器而不安装它。 First you have to install a memcached server. 首先,您必须安装一个内存缓存服务器。 You can use couchbase server with memcache bucket on Windows. 您可以在Windows 上将长沙发服务器与memcache存储桶一起使用。 IMHO it's the best port for Windows OS. 恕我直言,这是Windows操作系统的最佳端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM