PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Eugene Panin   ObjectCache2   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Usage example
Class: ObjectCache2
Stores objects in different types of chache
Author: By
Last change: Documentaion changed
Date: 21 years ago
Size: 865 bytes


Class file image Download
// @author Eugene Panin, <>
// Please visit our home page at

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
// Removing cache

// 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!
// You still not sure that object was in cache? Then remove it

$oc2 =& ObjectCache::factory('shmop',1,array('size'=>$size));
$res2 =& $oc2->find("test");
// You see, it's empty now