Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Khoa Bui  >  PHP Fast Cache  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: PHP Fast Cache
Store and get data from several cache containers
Author: By
Last change:
Date: 1 year ago
Size: 746 bytes
 

Contents

Class file image Download
<?php
include("php_fast_cache.php");
phpFastCache::$storage "auto";

// ready ?
// check in case first

$content phpFastCache::get("keyword1");

if(
$content == null) {
    
// for testing
    
echo "This is not caching, page is render with lot queires and slow speed <br>";
    
// do what you want, like get content from cURL | API | mySQL Query and return result to $content
    
$content file_get_contents("http://www.phpfastcache.com/testing.php");

    
// rewrite cache for other request in 5 seconds
    
phpFastCache::set("keyword1",$content,5);
} else {
    
// use cache
    // node
    
echo "THIS TIME USE CACHE, FAST! <br>";
}

echo 
"TRY F5 to refesh the page to see new SPEED with Cache!<br>";
echo 
$content;