Class CacheManager

Description

Implements interfaces:

A simple object cache

This cache simply stores serialized objects in files to gain more performance for objects which do not change on a regular basis, are session-independent and need a lot of time to be build. An example of usage is the ModuleList object in ModuleOverlay. This object needs only to be build when the module directory changes and does a lot of parsing (the ModuleItem object cached in this list parse their modinfo xml files on creation) - in reality this already makes a big difference when only one module is present (personal benchmark with one module gives a speedup factor of about 3 to 4 times when run for the second time).

The cache storage may be switched but when storage is only avaialable as module then the module cache will be built using the default file-based implementation. This might cause cache elements to be built twice.

Otherwise cache modules need to be patched into the core (I have done this with a memcached based implementation).

Located in /phpsatk-lib/core/05.cachemanager.php (line 52)


	
			
Method Summary
CacheManager __construct ()
void cleanUp ()
mixed getCachedObject (string $class, string $id, string $checksum)
boolean objectExists (string $class, string $id, string $checksum)
void putCacheObject (string $class, string $id, string $checksum, mixed $object)
void removeCacheObject (string $class, string $id, string $checksum)
void setInstance (CacheStorage $instance)
Methods
Constructor __construct (line 88)

Setup cache directory

Deletes cache files older than one week.

  • access: protected
CacheManager __construct ()
cleanUp (line 213)

This function cleans up the cache directory

All files older than one week will be deleted

  • access: public
void cleanUp ()
getCachedObject (line 142)

Fetches the cached object of a specified class/id

mixed getCachedObject (string $class, string $id, string $checksum)
  • string $class: Class name
  • string $id: Cache indentifier (e.g. storing multiple instances of a object)
  • string $checksum: Current checksum
getInstance (line 66)

Singleton method, gets a static instance

  • access: public
  • static:
CacheStorage getInstance ()
objectExists (line 122)

Checks whether an object exists in cache

If not the object using this has to create the wanted object, fill it with data and save it to the cache. Otherwise it can fetch it from the cache.

boolean objectExists (string $class, string $id, string $checksum)
  • string $class: Class name
  • string $id: Cache indentifier (e.g. storing multiple instances of a object)
  • string $checksum: Current checksum
putCacheObject (line 176)

Stores an object in the cache

  • access: public
void putCacheObject (string $class, string $id, string $checksum, mixed $object)
  • string $class: Class name
  • string $id: Cache indentifier (e.g. storing multiple instances of a object)
  • string $checksum: Current checksum
  • mixed $object: Object to store
removeCacheObject (line 158)

Removes the specified object from cache

  • access: public
void removeCacheObject (string $class, string $id, string $checksum)
  • string $class: Class name
  • string $id: Cache indentifier (e.g. storing multiple instances of a object)
  • string $checksum: Current checksum
setInstance (line 79)

Sets the used cached manager

  • access: public
  • static:
void setInstance (CacheStorage $instance)

Documentation generated on Mon, 21 May 2007 10:34:34 +0200 by phpDocumentor 1.3.0RC5