phpapcopcachexcache

Is there any compatible memory cache for PHP 7?


I would like to use PHP 7. However there seems to be no option for key-value memory caching.

APC is discontinued.

XCache will not be available for PHP 7 for some time.

Is there an available alternative for PHP 7?

Or is there a way to use PHP7's Opcache to implement key-value memory caching?


Solution

  • I'd suggest using Memcached, especially if you're concerned about performance.

    Whilst you are correct that APC(u) is a lot faster than Memcache, you're not taking into the account that by the time you're worrying about these metrics, you will be running across multiple servers and APC(u) cannot be shared across nodes.

    You can use a single Memcache instance or cluster to serve as many application servers as you want. Scalability is a greater concern in modern application development than "how much performance can I squeeze out of one server?"

    Having said that, your alternative is APCu, which has all of the functionality that you're used to from APC. It is marked as stable with PHP7 but I wouldn't recommend this because of its single-node nature & inability to work correctly with fastcgi.