Login   Register  
PHP Classes
elePHPant
Icontem

File: readme.md

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Xavier Pérez  >  XCache  >  readme.md  >  Download  
File: readme.md
Role: Documentation
Content type: text/plain
Description: Readme
Class: XCache
Store and retrieve data from different cache types
Author: By
Last change: Changed text
Added xcache driveAdded xcache driver
Date: 1 year ago
Size: 1,165 bytes
 

Contents

Class file image Download
# XCache

XCache v.2.2 (26/Jul/2013)

XCache can use apc / file / memcache and apc drivers to cache any object. 
All objects can be grouped under same TTL (time to live), to expire in same ammount of seconds.

Can save and retrieve any object / method result / sql result / string / array / file / html

Drivers for: files / apc / memcache / mongodb / xcache 


## Use

1) Edit xcacheconf.php and set your prefered values.

2) Include XCache.php in your code

		require ('XCache.php');

		
3) Instance XCache

		$XCache = XCache::getXCInstance();
		
		
4) Create a group in xcacheconf.php and set TTL.

		$config['cache_test'] = array ('MyTestGroup' => 30);
				
				
5) Call XCache:

		return $XCache->cache('cache_test','MyTestGroup','myUniqueID','MyValueOrObject');
		
		
5) Call a method with XCache :

		$XCache = XCache::getXCInstance();
		return $XCache->cache('cache_test','MyTestGroup','GetProduct_[ProductID]','MyProducts','getProduct','[ProductID]');
		
	This call execute: MyProducts->getProduct($ID)
	Remember to load (include/require) MyProducts class before to xcache call.
		
		
		
Execute 'demo.php' and take a look at the code to see how it works.