I am getting ready to upgrade a Debian server from PHP 5.6 to 7.0 via the dotdeb repositories. The Dotdeb repos do not have the (old) Memcache package, but they do have the (new) Memcached package. A third-party module I use relies on Memcache. Looking at the APIs, it appears that Memcached library should be fully backward compatible with Memcache, so that I can just do this:
if (!class_exists('Memcache') && class_exists('Memcached')) {
class Memcache extends Memcached
{
}
}
In testing it seems to work. The comments on the memcached documentation mention at least one gotcha, but since I am not looking to run them both at the same time, this one is not a problem.
However, I can't find anything else that talks about compatability. Is this a safe way to ensure backwards compatability between Memcached and Memcache or do I need a more sophisiticated adapter?