Class FileCache

Description

This core class handles File caching.

These functions provide simple mechanism for caching both item and non item information. Use these functions if you have anythinf to do that should normally not been done on the fly.

For example you are going to rescale an Image, do it and then save it as cache File!

Remember to delete your Cache Files from time to time!

Caching will be done in the subdirectory "cache" below your Consumer Home:

  1. /consumer/cid{CID}/cache/
. Where {CID} must be replaced by your Consumer ID.

  • version: $Id: FileCache.php,v 1.2 2006/11/26 22:04:33 kpapst Exp $
  • copyright: Copyright (C) 2002-2006 Kevin Papst
  • author: Kevin Papst
  • license: GNU Public License


			
Method Summary
void createCacheFile ( $name,  $content, [ $options = ''])
boolean createItemCacheFile ( $itemtype,  $itemid,  $content, [ $options = ''])
void deleteCacheFile ( $name, [ $options = ''])
boolean deleteItemCacheFile ( $itemtype,  $itemid, [ $options = ''])
void existsCacheFile ( $itemid, [ $options = ''])
boolean existsItemCacheFile (int $itemtype, int $itemid, [mixed $options = ''])
void expireAllCacheFiles ( $itemtype,  $itemid)
void getCacheContent ( $name, [ $options = ''])
mixed getItemCacheContent ( $itemtype,  $itemid, [ $options = ''])
Methods
createCacheFile (line 129)

Works as createItemCacheFile(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options, $content)

void createCacheFile ( $name,  $content, [ $options = ''])
  • $name
  • $content
  • $options
createItemCacheFile (line 71)

Creates a Cache File.

  • return: if Cache File could be created or not
boolean createItemCacheFile ( $itemtype,  $itemid,  $content, [ $options = ''])
  • $itemtype
  • $itemid
  • $content
  • $options
deleteCacheFile (line 140)

Works as deleteItemCacheFile(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options)

void deleteCacheFile ( $name, [ $options = ''])
  • $name
  • $options
deleteItemCacheFile (line 91)

Removes physically the Cache File from the filesystem

  • return: whether this cached Item File could be removed or not
boolean deleteItemCacheFile ( $itemtype,  $itemid, [ $options = ''])
  • $itemtype
  • $itemid
  • $options
doFullGarbageCollection (line 230)

This fluishes the entire Cache.

Before using this function aks yourself: "Do I really want to delete all Cache Files? Answer: YES - allright, go ahed. Answer: NO/DON'T KNOW - forget it, the result might be a performance leak within Scripts that extensively use caching as Performance Strategy. Try to remove Cache Files by explicit Identifiers.

void doFullGarbageCollection ()
existsCacheFile (line 101)

Works as existsItemCacheFile(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options)

void existsCacheFile ( $itemid, [ $options = ''])
  • $itemid
  • $options
existsItemCacheFile (line 61)

Checks if a Cache File exists for the given parameter combination.

  • return: whether the requested Item exists for given Options, or not
boolean existsItemCacheFile (int $itemtype, int $itemid, [mixed $options = ''])
  • int $itemtype: the Itemtype ID
  • int $itemid: the ItemID
  • mixed $options: the Options (that MUST be serializable - like simple arrays or Strings)
expireAllCacheFiles (line 110)

Tries to expire all cached Files for the given Itemtype/ItemID combination.

We do not care about the Options while creating the Cache Files.

void expireAllCacheFiles ( $itemtype,  $itemid)
  • $itemtype
  • $itemid
getCacheContent (line 150)

Works as getItemCacheContent(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options)

void getCacheContent ( $name, [ $options = ''])
  • $name
  • $options
getItemCacheContent (line 81)

Reads the content from Cache File.

  • return: content if file exists, else false!
mixed getItemCacheContent ( $itemtype,  $itemid, [ $options = ''])
  • $itemtype
  • $itemid
  • $options

Documentation generated by phpDocumentor 1.3.1