Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f077b5816934b3291a7ef6b204408a3c > files > 19

ezcomponents-Cache-1.5-3.mga4.noarch.rpm

<?php

require_once 'tutorial_autoload.php';

$options = array(
    'ttl'   => 30,
);

ezcCacheManager::createCache( 'simple', '/tmp/cache/plain', 'ezcCacheStorageFilePlain', $options );

$myId = 'unique_id_1';
$mySecondId = 'id_2';

$cache = ezcCacheManager::getCache( 'simple' );

if ( ( $dataOfFirstItem = $cache->restore( $myId ) ) === false )
{
    $dataOfFirstItem = "Plain cache stored on " . date( 'Y-m-d, H:i:s' );
    $cache->store( $myId, $dataOfFirstItem );
}

if ( ( $dataOfSecondItem = $cache->restore( $mySecondId ) ) === false )
{
    $dataOfSecondItem = "Plain cache 2 stored on " . date( 'Y-m-d, H:i:s' );
    $cache->store( $mySecondId, $dataOfSecondItem );
}

var_dump( $dataOfFirstItem, $dataOfSecondItem );

?>