60*60*24*2, // Default would be 24hrs, here 48hrs ); // Options could also be storage dependant. The only global option is // 'ttl', the time-to-live. CacheManager::createCache( 'content', '/var/cache/content', 'ezcCacheStorageView', $options ); CacheManager::createCache( 'template', '/var/cache/templates', 'ezcCacheStorageTemplate', $options ); CacheManager::createCache( 'image', '/var/cache/images', 'ezcCacheStorageArray', $options ); // 3 caches are now available in the manager: // - 'content', located in /var/cache/content, using the eZ publish specific View storage // - 'template', located in /var/cache/templates, using the eZ publish specific Template storage // - 'image', located in /var/cache/images, using the builtin Array storage.; /** * Storing and restoring data */ // First retreive tha cache you want to access from the manager. $cache = CacheManager::getCache( 'content' ); // Prepare your data identification, use some attributes and a unique ID $attributes = array( 'node' => 2, 'area' => 'admin', 'lang' => 'en-GB' ); $id = getUniqueId(); // Initialize your data variable $data = ''; // Check if data is available in the cache if ( !( $data = $cache->restore( $id, $attributes ) ) ) { // No data in cache or data has expired. Generate new data... $data = generateMyData(); // ... and store it inside the cache $cache->store( $id, $attributes, $data ); } /** * Deleting and purgin caches. */ // Retreive the correct cache again $cache = CacheManager::getCache( 'template' ); // Remove all cache blocks that have the attribute "node" set to "2". $cache->delete( null, array( 'node' => 2 ) ); ?>