PhpCache: NullDriver why ?

If you want to avoid this code in your class using the cache, the NullDriver and a possible answer.

Step 1 : In constructor, check if you have a real cache système

If cache objet is null, instantiate the null driver in a new PhpCache.

Step 2 : remove all if ($this->cache) in your class method and use cache normally.