PHP Classes

XCache: Store and retrieve data from different cache types

Recommend this page to a friend!
  Info   View files Example   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-02-28 (23 days ago) RSS 2.0 feedNot enough user ratingsTotal: 225 All time: 8,163 This week: 171Up
Version License PHP version Categories
xcache 2.1MIT/X Consortium ...5.3PHP 5, Cache
Description 

Author

This package can store and retrieve data of any type from different cache types.

The base class can perform several types of operations with cached data like storing a given cache entry with a given key name for given amount of time, check if a cached entry exists, retrieve a cached data entry, increment a cache value, delete a cached entry, or delete all cache entries.

The class can also capture the current script output and store it in a cache entry if it is not yet cached.

The package comes with several sub-classes to support storing and retrieving cached data from different containers.

Currently it provides sub-classes to cache data in files, APC, memcached, MongoDB and a dummy container.

The base class can load a configuration script that defines options of the caching process.

Picture of Xavier Pérez
  Performance   Level  
Name: Xavier Pérez is available for providing paid consulting. Contact Xavier Pérez .
Classes: 9 packages by
Country: Spain Spain
Age: ???
All time rank: 133326 in Spain Spain
Week rank: 152 Up6 in Spain Spain Up
Innovation award
Innovation award
Nominee: 1x

Details
# 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.
  Files folder image Files  
File Role Description
Files folder imagedrivers (6 files)
Accessible without login Plain text file demo.php Example Demo.php
Accessible without login Plain text file readme.md Doc. Readme
Plain text file XCache.php Class Main class
Plain text file xcacheconf.php Conf. XCche config file

  Files folder image Files  /  drivers  
File Role Description
  Plain text file XCache_apc.php Class APC driver
  Plain text file XCache_dummy.php Class Dummy driver
  Plain text file XCache_file.php Class File driver
  Plain text file XCache_memcache.php Class Memcache driver
  Plain text file XCache_mongodb.php Class MongoDB driver
  Plain text file XCache_xcache.php Class New driver

 Version Control Unique User Downloads Download Rankings  
 100%
Total:225
This week:0
All time:8,163
This week:171Up
User Comments (1)
This is a good class ;-)
9 years ago (José Filipe Lopes Santos)
80%StarStarStarStarStar