Class: FileCache

Source Location: /CORE/system/classes/core/FileCache.php

Class FileCache

Class Overview

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.

Located in /CORE/system/classes/core/FileCache.php [line 53]



		
				Author(s):
		
  • Kevin Papst
Information Tags:
Version:  $Id: FileCache.php,v 1.4 2008/09/20 19:58:51 kpapst Exp $
Copyright:  Copyright (C) Kevin Papst
License:  GNU Public License

Methods

[ Top ]
Method Summary
static void   createCacheFile()   Works as createItemCacheFile(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options, $content)
static boolean   createItemCacheFile()   Creates a Cache File.
static void   deleteCacheFile()   Works as deleteItemCacheFile(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options)
static boolean   deleteItemCacheFile()   Removes physically the Cache File from the filesystem
static void   doFullGarbageCollection()   This fluishes the entire Cache.
static void   existsCacheFile()   Works as existsItemCacheFile(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options)
static boolean   existsItemCacheFile()   Checks if a Cache File exists for the given parameter combination.
static void   expireAllCacheFiles()   Tries to expire all cached Files for the given Itemtype/ItemID combination.
static void   getCacheContent()   Works as getItemCacheContent(_BIGACE_DEFAULT_CACHE_ITEMTYPE, $name, $options)
static mixed   getItemCacheContent()   Reads the content from Cache File.
static void   get_cache_url()  

[ Top ]
Methods
static method createCacheFile  [line 133]

  static void createCacheFile( $name, $content, [ $options = '']  )

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

Parameters:
   $name: 
   $content: 
   $options: 

API Tags:
See:  FileCache::createItemCacheFile()


[ Top ]
static method createItemCacheFile  [line 72]

  static boolean createItemCacheFile( $itemtype, $itemid, $content, [ $options = '']  )

Creates a Cache File.

Parameters:
   $itemtype: 
   $itemid: 
   $content: 
   $options: 

API Tags:
Return:  if Cache File could be created or not


[ Top ]
static method deleteCacheFile  [line 144]

  static void deleteCacheFile( $name, [ $options = '']  )

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

Parameters:
   $name: 
   $options: 

API Tags:
See:  FileCache::deleteItemCacheFile()


[ Top ]
static method deleteItemCacheFile  [line 95]

  static boolean deleteItemCacheFile( $itemtype, $itemid, [ $options = '']  )

Removes physically the Cache File from the filesystem

Parameters:
   $itemtype: 
   $itemid: 
   $options: 

API Tags:
Return:  whether this cached Item File could be removed or not


[ Top ]
static method doFullGarbageCollection  [line 232]

  static void doFullGarbageCollection( )

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.



[ Top ]
static method existsCacheFile  [line 105]

  static void existsCacheFile( $itemid, [ $options = '']  )

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

Parameters:
   $itemid: 
   $options: 

API Tags:
See:  FileCache::existsItemCacheFile()


[ Top ]
static method existsItemCacheFile  [line 62]

  static boolean existsItemCacheFile( int $itemtype, int $itemid, [mixed $options = '']  )

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

Parameters:
int   $itemtype:  the Itemtype ID
int   $itemid:  the ItemID
mixed   $options:  the Options (that MUST be serializable - like simple arrays or Strings)

API Tags:
Return:  whether the requested Item exists for given Options, or not


[ Top ]
static method expireAllCacheFiles  [line 114]

  static void expireAllCacheFiles( $itemtype, $itemid  )

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

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

Parameters:
   $itemtype: 
   $itemid: 


[ Top ]
static method getCacheContent  [line 154]

  static void getCacheContent( $name, [ $options = '']  )

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

Parameters:
   $name: 
   $options: 

API Tags:
See:  FileCache::getItemCacheContent()


[ Top ]
static method getItemCacheContent  [line 82]

  static mixed getItemCacheContent( $itemtype, $itemid, [ $options = '']  )

Reads the content from Cache File.

Parameters:
   $itemtype: 
   $itemid: 
   $options: 

API Tags:
Return:  content if file exists, else false!


[ Top ]
static method get_cache_url  [line 87]

  static void get_cache_url( $name, [ $options = '']  )

Parameters:
   $name: 
   $options: 


[ Top ]