Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 873
Frodik Avatar asked May 09 '16 06:05

Frodik


People also ask

Is Memcached faster than Redis?

Redis uses a single core and shows better performance than Memcached in storing small datasets when measured in terms of cores. Memcached implements a multi-threaded architecture by utilizing multiple cores. Therefore, for storing larger datasets, Memcached can perform better than Redis.

What is PHP APCu caching?

APC User Cache (APCu) Alternative PHP Cache (APC) is a free and an open source PHP accelerator. Like Zend OPcache, it's mainly designed to cache the PHP opcode output in the server's shared memory.

What does memcached do in PHP?

Memcached is an object caching system. It is primarily used to cache the results of database queries, helping dynamic websites like WordPress® and Drupal to serve pages faster. It can also significantly decrease resource use on a busy web server by reducing calls to the database.


1 Answers

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.

like image 133
Matt Prelude Avatar answered Sep 19 '22 17:09

Matt Prelude