Login   Register  
PHP Classes
elePHPant
Icontem

File: example/memcache-example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Oscar Gentilezza  >  Hybrid Cache  >  example/memcache-example.php  >  Download  
File: example/memcache-example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Hybrid Cache
Store key-value pairs in different containers
Author: By
Last change:
Date: 2012-09-22 21:34
Size: 479 bytes
 

Contents

Class file image Download
<?php

require('../lib/init.php');

use 
Hybrid\Cache;
use 
Hybrid\storages\Memcache as MemcacheStorage;


// Set your host/port
Cache::addStorageMedia( new MemcacheStorage('localhost') );

$cache Cache::create('key');

if (
$data $cache->getCache(true)) {
    echo 
"del cache: " $data;
    echo 
"\n";
    exit(
0);
} else {
    
$cache->setStatusSaving();
}


echo 
"Generando contenido";

sleep(5);

$contenido md5(rand(1,99999));

echo 
$contenido;
echo 
"\n";

$cache->save($contenido);