PHP Classes
elePHPant
Icontem

File: documentation/purge-cache-apc.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Camilo Sperberg  >  Cache Manager  >  documentation/purge-cache-apc.php  >  Download  
File: documentation/purge-cache-apc.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Cache Manager
Manage cache containers to store and retrieve data
Author: By
Last change:
Date: 1 year ago
Size: 1,023 bytes
 

Contents

Class file image Download
<?php

$languageIds
= array('en_US', 'en_UK', 'nl_NL', 'es_ES', 'es_CL');

include(
'../cacheManager.class.php');

try {
   
$cache = new u4u\cacheManager('apc', true);
} catch(
u4u\cacheException $e) {
    print(
'Exception caught! Message: "'.$e->getMessage().'"<br />');
   
$cache = new u4u\cacheManagerNoChecks('default');
    print(
'Going back to "'.$cache->cacheName.'" base class! This equals no cache at all!<br />');
} catch (
u4u\versionException $e) {
    die(
$e->getMessage());
}

try {
   
$deletedCount = $cache->purgeIdentifierCache('random-data');
    print(
'Deleted '.$deletedCount.' caches of type "random-data"');
} catch (
u4u\cacheException $e) {
    print(
'Exception caught! Message: "'.$e->getMessage().'"<br />');
}

$result = $cache->delete('languageMessages', $languageIds);
print(
'<br />Deleted cache languageMessages');
var_dump($result);

$result = $cache->purgeCache();
print(
'<br />Purged entire cache');
var_dump($result);

echo
'<a href="create-cache-apc.php">Create all APC caches again</a>';