Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

Latest commit

 

History

History
93 lines (59 loc) · 2.42 KB

zend.cache.pattern.output-cache.rst

File metadata and controls

93 lines (59 loc) · 2.42 KB

Zend\Cache\Pattern\OutputCache

Overview

The OutputCache pattern caches output between calls to start() and end().

Quick Start

Instantiating the output cache pattern

use Zend\Cache\PatternFactory;

$outputCache = PatternFactory::factory('output', array(
    'storage' => 'apc'
));

Configuration Options

Option Data Type Default Value Description
storage string array Zend\Cache\Storage\StorageInterface <none> The storage to write/read cached data

Available Methods

start(string $key)

If there is a cached item with the given key display it's data and return true else start buffering output until end() is called or the script ends and return false.

rtype

boolean

end()

Stops buffering output, write buffered data to cache using the given key on start() and displays the buffer.

rtype

boolean

setOptions(Zend\Cache\Pattern\PatternOptions $options)

Set pattern options.

rtype

Zend\Cache\Pattern\OutputCache

getOptions()

Get all pattern options.

rtype

Zend\Cache\Pattern\PatternOptions

Examples

Caching simple view scripts

$outputCache = Zend\Cache\PatternFactory::factory('output', array(
    'storage' => 'apc',
));

$outputCache->start('mySimpleViewScript');
include '/path/to/view/script.phtml';
$outputCache->end();