View Source

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

{zone-data:component-name}
Zend_Cache backend for Zend Platform
{zone-data}

{zone-data:proposer-list}
[Stanislav Malyshev|mailto:stas@zend.com]
{zone-data}

{zone-data:revision}
1.1 - 1 August 2006: Updated from community comments.
{zone-data}

{zone-data:overview}
The Zend Platform backend for Zend_Cache would allow developers to use Zend Platform content caching capabilities with Zend_Cache class.
{zone-data}

{zone-data:references}
* [Zend Platform|http://www.zend.com/platform]
* [Zend_Cache Proposal|http://framework.zend.com/wiki/display/ZFPROP/Zend_Cache+Proposal+-+Fabien+MARTY]
{zone-data}

{zone-data:requirements}
* 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"
{zone-data}

{zone-data:dependencies}
* Zend_Cache
* Zend_Cache_Backend_Interface
{zone-data}

{zone-data:operation}
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.
{zone-data}

{zone-data:class-list}
* Zend_Cache_Backend_ZendPlatform
{zone-data}

{zone-data:use-cases}
||UC-01||
{code}
$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().').';
{code}
{zone-data}
{zone-data:milestones}
# Submit the proposal
# Get the proposal approved
# Commit the backend and the tests to the SVN repository
# Write documentation for the backend
{zone-data}
{zone-data:skeletons}
{code}
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())
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>