<?php
// @author Eugene Panin, <varenich@yahoo.com>
// Please visit our home page at http://www.tortuga.pp.ru
require 'ObjectCache/ObjectCache.php';
// Allocating object
$ttt = 987492138491287349;
// Shared memory block size
$size = 500;
// Getting object cache
$oc =& ObjectCache::factory('shmop',1,array('size'=>$size));
// Put object into cache
$oc->add('test',&$ttt);
// Removing cache
unset($oc);
// Imaging that it's another script in another time :-)
$oc1 =& ObjectCache::factory('shmop',1,array('size'=>$size));
$res =& $oc1->find("test");
// Wow! Our object is here!
var_dump($res);
// You still not sure that object was in cache? Then remove it
$oc1->remove("test");
unset($oc1);
$oc2 =& ObjectCache::factory('shmop',1,array('size'=>$size));
$res2 =& $oc2->find("test");
// You see, it's empty now
var_dump($res2);
?>
|