zendframework/zend-cache
zendframework/zend-cache provides flexible caching for PHP apps with multiple storage backends (filesystem, memory, APCu, Redis, and more). Supports cache patterns, plugins, serialization, and configurable adapters to improve performance and reduce repeated work.
The OutputCache pattern caches output between calls to start() and end().
use Zend\Cache\PatternFactory;
$outputCache = PatternFactory::factory('output', [
'storage' => 'apc'
]);
| Option | Data Type | Default Value | Description |
|---|---|---|---|
storage |
`string | array | Zend\Cache\Storage\StorageInterface` |
In addition to the methods defined in PatternInterface, this implementation
defines the following methods.
namespace Zend\Cache\Pattern;
use Zend\Cache\Exception;
class OutputCache extends AbstractPattern
{
/**
* If there is a cached item with the given key, display its data, and
* return true. Otherwise, start buffering output until end() is called, or
* the script ends.
*
* [@param](https://github.com/param) string $key Key
* [@throws](https://github.com/throws) Exception\MissingKeyException if key is missing
* [@return](https://github.com/return) bool
*/
public function start($key);
/**
* Stop buffering output, write buffered data to the cache using the key
* provided to start(), and display the buffer.
*
* [@throws](https://github.com/throws) Exception\RuntimeException if output cache not started or buffering not active
* [@return](https://github.com/return) bool TRUE on success, FALSE on failure writing to cache
*/
public function end();
}
$outputCache = Zend\Cache\PatternFactory::factory('output', [
'storage' => 'apc',
]);
$outputCache->start('mySimpleViewScript');
include '/path/to/view/script.phtml';
$outputCache->end();
How can I help you explore Laravel packages today?