12

我似乎找不到 PHP 的 Memcache D扩展。

php_memcache.dll 有一些编译,但不一样。

我缺少的主要内容是getMulti(),它在 Memcache 中不存在。

到目前为止,我找到了这个,但没有 DLL:

http://pecl.php.net/package/memcached

4

2 回答 2

6

正式 - 它不存在。不过,有几个人创建了自己的 DLL。这是一个创建 dll 的人的博客:

http://trondn.blogspot.com/2010/07/libmemcached-on-win32.html

以下是包含源代码的存储库的链接,因此您可以为 memcached 构建自己的 DLL:

http://bazaar.launchpad.net/~trond-norbye/libmemcached/mingw32/files

于 2013-01-09T20:53:19.560 回答
5

我知道 memcached 还有一些其他功能,但它的界面与 memcache 扩展的界面几乎相同。你可以很容易地摆脱这样的代码,就我而言,它运行得很好。如果您没有加载 memcached,请创建此文件:


<?php

    class Memcached {
       const OPT_LIBKETAMA_COMPATIBLE = true;
       const OPT_COMPRESSION = true;
       const OPT_NO_BLOCK = true;
       //if you code relies on any other constants define them to avoid
       //undefined constant notice

       //http://www.php.net/manual/en/memcached.constants.php

       public $_instance;
       public function __construct() {
            $this->_instance = new Memcache;
       }

       public function __call($name, $args) {
            return call_user_func_array(array($this->_instance, $name), $args);
       }

       public function setOption() {}
    }


要么包括它,要么配置自动加载器来拾取它。当然,您需要正确配置的 memcache 实例和 addServer 调用,但如果代码库假定 Memcached,则此类调用应该已经在代码中。我希望它可以帮助某人/

于 2013-10-29T09:18:48.503 回答