Phpfox_Cache_Storage_Memcache

Description

Memcached Cache Layer - This class handles the cache routine for phpFox and can store arrays, strings and objects. All the data is stored in memcached which has a unique id. Data is also serilazed before its stored.

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

Located in /include/library/phpfox/cache/storage/memcache.class.php (line 18)

Phpfox_Cache_Abstract
   |
   --Phpfox_Cache_Storage_Memcache
Variable Summary
 array $_aCached
 array $_aName
 object $_oDb
Method Summary
 Phpfox_Cache_Storage_Memcache __construct ()
 void close (string $sId)
 mixed get (string $sId, [int $iTime = 0])
 array getCachedFiles ([array $aConds = array()], string $sSort, int $iPage, string $sLimit)
 bool isCached (string $sId, [string $iTime = 0])
 bool remove ([string $sName = null], [string $sType = ''])
 void save (string $sId, string $mContent)
 string set (string $sName, [string $sGroup = ''])
 object Returns skipClose (bool $bClose)
 string _getName (string $sFile)
Variables
array $_aCached = array() (line 39)

Array of all the cache data we have saved.

  • access: private
array $_aName = array() (line 25)

Array of all the cache files we have saved.

  • access: private
bool $_bFromMemory = false (line 47)

Set this to true and we will force the system to get the information from a memory based caching system (eg. memcached)

  • access: private
bool $_bSkipClose = false (line 56)

By default we always close a cache call automatically, however at times you may need to close it at a later time and setting this to true will skip closing the closing of the cache reference.

  • access: private
object $_oDb = null (line 32)

Memcached object

  • access: private

Inherited Variables

Inherited from Phpfox_Cache_Abstract

Phpfox_Cache_Abstract::$_aParams
Phpfox_Cache_Abstract::$_aStats
Methods
Constructor __construct (line 62)

We open up a connection to each of the memcached servers.

  • access: public
Phpfox_Cache_Storage_Memcache __construct ()

Redefinition of:
Phpfox_Cache_Abstract::__construct()
Load all the custom params in a protected variable array.
close (line 233)

Close the cache connection.

  • access: public
void close (string $sId)
  • string $sId: ID of the cache file we plan on closing the connection with.
get (line 118)

We attempt to get the cache file. Also used within an IF conditional statment to check if the file has already been cached.

  • return: If the file is cached we return the data. If the file is cached but emptry we return a true (bool). if the file has not been cached we return false (bool).
  • see: self::set()
  • access: public
mixed get (string $sId, [int $iTime = 0])
  • string $sId: Unique ID of the file we need to get. This is what is returned from when you use the set() method.
  • int $iTime: By default this is left blank, however you can identify how long a file should be cached before it needs to be updated in minutes.
getCachedFiles (line 347)

Gets all the cache files and returns information about the cache file to stats.

  • return: First array is how many cache files there are and the 2nd array holds all the cache files.
  • access: public
array getCachedFiles ([array $aConds = array()], string $sSort, int $iPage, string $sLimit)
  • array $aConds: SQL conditions (not used anymore)
  • string $sSort: Sorting the cache files
  • int $iPage: Current page we are on
  • string $sLimit: Limit of how many files to display
isCached (line 317)

Checks if a file is cached or not.

  • return: Returns true if the file is cached and false if the file hasn't been cached already.
  • access: public
bool isCached (string $sId, [string $iTime = 0])
  • string $sId: Unique ID of the cache file.
  • string $iTime: By default no timestamp check is done, howver you can pass an int to check how many minutes a file can be cached before it must be recached.
remove (line 246)

Removes cache file(s).

  • return: Returns true if we were able to remove the cache file and false if the system was locked.
  • access: public
bool remove ([string $sName = null], [string $sType = ''])
  • string $sName: Name of the cache file we need to remove.
  • string $sType: Pass an optional command to execute a specific routine.
save (line 201)

Save data to the cache.

  • see: self::set()
  • access: public
void save (string $sId, string $mContent)
  • string $sId: Unique ID connecting to the cache file based by the method set()
  • string $mContent: Content you plan on saving to cache. Can be bools, strings, ints, objects, arrays etc...
set (line 80)

Sets the name of the cache.

  • return: Returns the unique ID of the file name
  • access: public
string set (string $sName, [string $sGroup = ''])
  • string $sName: Unique fill name of the cache.
  • string $sGroup: Optional param to identify what group the cache file belongs to
skipClose (line 102)

By default we always close a cache call automatically, however at times you may need to close it at a later time and setting this to true will skip closing the closing of the cache reference.

  • return: the classes object.
  • access: public
object Returns skipClose (bool $bClose)
  • bool $bClose: True to skip the closing of the connection
_getName (line 374)

Returns the name of the cache file. Memcached does nothing special here so we just return the file name.

  • return: Return the file name. Nothing to do...
  • access: private
string _getName (string $sFile)
  • string $sFile: File name of the cache

Inherited Methods

Inherited From Phpfox_Cache_Abstract

 Phpfox_Cache_Abstract::__construct()
 Phpfox_Cache_Abstract::getAll()
 Phpfox_Cache_Abstract::getData()
 Phpfox_Cache_Abstract::getStatic()
 Phpfox_Cache_Abstract::getStats()
 Phpfox_Cache_Abstract::lock()
 Phpfox_Cache_Abstract::removeInfo()
 Phpfox_Cache_Abstract::removeStatic()
 Phpfox_Cache_Abstract::saveInfo()
 Phpfox_Cache_Abstract::unlock()
 Phpfox_Cache_Abstract::_getParam()

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