I tried your solution on PHP 7.1.3
Daniel Bunte

There are a few things that can stop the cache from working.

  1. Is Zend OPcache enabled in your PHP 7.1 installation?
  2. Is your opcache memory limit high enough to store all the objects you are trying to cache?
  3. Are you actually trying to cache objects/arrays, or are you using primitives? Strings/numbers should still be fast using this method, but they might be a tad slower than APCu because there is no serialization taking place.
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.