Phpfox_Cache

Description

Class is used to cache any sort of data that is passed via PHP.

Currenlty there is support for file based caching and memcached. It is perfect to store output from SQL queries that do not need to be executed each time a user visits a specific page.

Example of using the cache system:

  1.  $oCache Phpfox::getLib('cache');
  2.  // Create a name for your cache file
  3.  $sCacheId $oCache->set('cache_file_name');
  4.  // Check if the file is already cached
  5.  if (!($aData $oCache->get($sCacheId)))
  6.  {
  7.          // Run SQL query here...
  8.          $aData array(1234);
  9.          // Store data in the the cache file (eg. strings, arrays, bools, objects etc...)
  10.          $oCache->save($sCacheId$aData);
  11.  }
  12.  print_r($aData);

If you want to remove a cache file:

  1.  Phpfox::getLib('cache')->remove('cache_file_name');

If you want to get all the files that have been cached:

  1.  // Array of files.
  2.  $aFiles Phpfox::getLib('cache')->getCachedFiles();

  • author: Raymond Benc
  • version: $Id: cache.class.php 1687 2010-07-22 03:13:27Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]

Located in /include/library/phpfox/cache/cache.class.php (line 48)


	
			
Variable Summary
 object $_oObject
Method Summary
 Phpfox_Cache __construct ([array $aParams = array()])
 object Object &getInstance ()
Variables
object $_oObject = null (line 55)

Object of the storage class.

  • access: private
Methods
Constructor __construct (line 63)

Based on what storage system is set within the global settings this is where we load the file.

You can also pass any params to the storge object.

  • access: public
Phpfox_Cache __construct ([array $aParams = array()])
  • array $aParams: Any extra params you may want to pass to the storage object.
getInstance (line 87)

Return the object of the storage object.

  • return: provided by the storage class we loaded earlier.
  • access: public
object Object &getInstance ()

Documentation generated on Tue, 28 Sep 2010 10:36:37 +0200 by phpDocumentor 1.4.0a2