Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at:
Zend\Cache\Pattern — Zend Framework 2 2.0.7 documentation
Cache patterns are configurable objects to solve known performance bottlenecks. Each should be used only in the specific situations they are designed to address. For example you can use one of the CallbackCache, ObjectCache or ClassCache patterns to cache method and function calls; to cache output generation, the OutputCache pattern could assist.
All cache patterns implement the same interface, Zend\Cache\Pattern\PatternInterface, and most extend the abstract class Zend\Cache\Pattern\AbstractPattern to implement basic logic.
Configuration is provided via the Zend\Cache\Pattern\PatternOptions class, which can simply be instantiated with an associative array of options passed to the constructor. To configure a pattern object, you can set an instance of Zend\Cache\Pattern\PatternOptions with setOptions, or provide your options (either as an associative array or PatternOptions instance) as the second argument to the factory.
It’s also possible to use a single instance of Zend\Cache\Pattern\PatternOptions and pass it to multiple pattern objects.
Pattern objects can either be created from the provided Zend\Cache\PatternFactory factory, or, by simply instantiating one of the Zend\Cache\Pattern\*Cache classes.
1 2 3 4
// Via the factory: $callbackCache = Zend\Cache\PatternFactory::factory('callback', array( 'storage' => 'apc', ));
1 2 3 4 5
// OR, the equivalent manual instantiation: $callbackCache = new Zend\Cache\Pattern\CallbackCache(); $callbackCache->setOptions(new Zend\Cache\Pattern\PatternOptions(array( 'storage' => 'apc', )));
The following methods are implemented by Zend\Cache\Pattern\AbstractPattern. Please read documentation of specific patterns to get more information.
Set pattern options.
Get all pattern options.