PHP Classes
elePHPant
Icontem

File: tests/sample.memcached.php

Recommend this page to a friend!
  Classes of Oleg Butuzov  >  Cacheme  >  tests/sample.memcached.php  >  Download  
File: tests/sample.memcached.php
Role: Example script
Content type: text/plain
Description: one more sample
Class: Cacheme
Cache data in different types of container
Author: By
Last change:
Date: 8 years ago
Size: 680 bytes
 

Contents

Class file image Download
<?
   
include dirname(dirname(__FILE__)).'/Cacheme/Cacheme.php';
   
   
$cache = CacheMeLoader::Factory('memcache://127.0.0.1:11211');
   
       
$cache->lifetime = 10;
   
       

   
$cache->lifetime = 24*60*60;
   
   
$mycoolvariable = "mycoolvariable";

   
/* setting variable */
   
$cache->set($mycoolvariable, $mycoolvariable);

   
   
/* getting variable */
   
var_dump('1 - '.$cache->get($mycoolvariable));

   
/* flush */
   
$cache->clear();
   
var_dump('2 not exists'.$cache->get($mycoolvariable));
   
   
$cache->set($mycoolvariable, $mycoolvariable);

   
/* delete variable */
   
$cache->clear($mycoolvariable);
   
var_dump('3 not exists'.$cache->get($mycoolvariable));
   
?>