Skip to content

When should I use Memcache instead of Memcached?

Memcache and Memcached are both in-memory key-value stores that are commonly used to cache data to improve application performance. The main difference is that Memcache is a PHP extension, while Memcached is a standalone, cross-platform daemon/server with clients available for many programming languages. Memcached also includes additional features and protocol optimizations.

Here are some examples of when you might use Memcache instead of Memcached:

  • If you are already using Memcache in your infrastructure, and it meets your performance and scalability requirements, there may be no need to switch to Memcached.
  • If you have a legacy application that was built to use Memcache and you don't want to make changes to the code to switch to Memcached.
  • If you are developing a PHP-only application and prefer the simpler, PHP-specific extension.

On the other hand, here are some examples of when you might use Memcached instead of Memcache:

  • If you are starting a new project, and you want to use a caching solution that is actively maintained and has more features than Memcache.
  • If your application requires fine-grained control over the storage and retrieval of items. Both systems primarily rely on LRU eviction, but Memcached offers more flexibility in configuration and broader language support.
  • If you want to take advantage of Memcached's binary protocol, which is more efficient for serialization than the text-based protocol typically used by the Memcache extension.

In general, the choice between Memcache and Memcached depends on the specific requirements of your application and the infrastructure you have in place.

Dual-run preview — compare with live Symfony routes.