View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

Zend_Cache backend for Zend Platform

[Stanislav Malyshev|]

1.1 - 1 August 2006: Updated from community comments.

The Zend Platform backend for Zend_Cache would allow developers to use Zend Platform content caching capabilities with Zend_Cache class.

* [Zend Platform|]
* [Zend_Cache Proposal|]

* This backend would allow to store and retrieve data in Zend Platform PHP API cache.
* Tags will be partially supported - you can set tag and clean by tag, but not clean by "not having the tag"

* Zend_Cache
* Zend_Cache_Backend_Interface

The backend will use Zend Platform functions output_cache_get and output_cache_set to store and retrieve information from the Zend Platform PHP API cache. No support for full-page cache and for more advanced functions of Zend Platform caching API.

* Zend_Cache_Backend_ZendPlatform

$frontendOptions = array(
'lifeTime' => 30, // cache lifetime of half a minute
'automaticSerialization' => false // this is default anyway

$backendOptions = array();

$cache = Zend_Cache::factory('Output', 'ZendPlatform', $frontendOptions, $backendOptions);

// we pass a unique identifier to the start() method
if(!$cache->start('mypage')) {
// output as usual:

echo 'Hello world! ';
echo 'This is cached ('.time().') ';

$cache->end(); // the output is saved and sent to the browser

echo 'This is never cached ('.time().').';
# Submit the proposal
# Get the proposal approved
# Commit the backend and the tests to the SVN repository
# Write documentation for the backend
class Zend_Cache_Backend_ZendPlatform implements Zend_Cache_Backend_Interface {
public function __construct($options = array());
public function setDirectives($directives)
public function setOption($name, $value)
public function get($id, $doNotTestCacheValidity = false)
public function test($id)
public function save($data, $id, $tags = array())
public function remove($id)
public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())