Home » Php » php – HHVM Memcache integration

php – HHVM Memcache integration

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have a Drupal 7 website with Memcache installed, which is working fine on an Apache2 web server. Now I’ve replaced Apache2 with HHVM (HipHop) and got a real boost on performance.

The problem is that obviously Drupal can not interact with the Memcache server. Here is the error:

Notice: Use of undefined constant MEMCACHE_COMPRESSED - assumed 'MEMCACHE_COMPRESSED' in dmemcache_set() (line 44 of /.../modules/memcache/dmemcache.inc).

and of course nothing is stored in the Memcache.

I suppose that Drupal’s Memcache module is using PECL’s Memcache:set() which is not available in this newly installed HHVM. Is there any PECL-like installation for HHVM?

Thanks

How to&Answers:

PECL extensions are unlikely to be compatible with HHVM, but “pure PHP” implementations might still work. It will be slower than something written in C, but the benefit of caching will probably outweigh any disadvantage in raw speed.

Someone already suggested that Drupal should include a pure PHP implementation in case the Memcache/Memcached extension is not available. The suggestion includes links to some of the alternatives, so check them out:

https://drupal.org/node/1999804

I took a a quick look at the first link, and unfortunately the methods and constants don’t seem to be 100% compatible with the PECL extension. But you might be able to extend the class, add some missing constants, and change the order of arguments to match the methods of the PECL extension.