Class XOAD_Cache

Description

XOAD_Cache Class.

This class allows you to cache the callbacks to the server. By default the caching is disabled and you must call XOAD_Cache::allowCaching to configure which classes and methods will be cached.

Example:

  1. <?php
  2.  
  3. XOAD_Cache::allowCaching('ExampleClass', 'invokeMethod', 30);
  4.  
  5. ?>

  • version: 0.6.0.0
  • author: Stanimir Angeloff

Located in /extensions/cache/classes/Cache.class.php (line 56)


	
			
Method Summary
 void allowCaching ([array $className = null], [array $method = null], [array $expire = null], [array $arguments = null], [array $members = null])
 bool cacheRequest (array &$request, array &$response)
 bool dispatch (array &$request, array &$cacheData)
 object Singleton &getStorage ()
 bool initialize (array &$request)
Methods
allowCaching (line 348)

Installs a new caching criteria.

By default the caching is disabled and you must call this method to configure which classes and methods will be cached.

If you call this method with no arguments, caching will be enabled for all classes and methods.

When generating the ID for each request the class name, method name and arguments list is used to build a long string which is later used for the ID. You can configure XOAD_Cache to include some of the class variables too.

Example:

  1. <?php
  2.  
  3. // Allow caching for all classes.
  4. XOAD_Cache::allowCaching();
  5.  
  6. // Allow caching only for the 'Example' class.
  7. XOAD_Cache::allowCaching('Example');
  8.  
  9. // Allow caching only for the 'Example->invoke' method.
  10. XOAD_Cache::allowCaching('Example', 'invoke');
  11.  
  12. // Allow caching for the 'invoke' method in every class.
  13. XOAD_Cache::allowCaching(null, 'invoke');
  14.  
  15. ?>

  • static:
  • access: public
void allowCaching ([array $className = null], [array $method = null], [array $expire = null], [array $arguments = null], [array $members = null])
  • array $className: The class name filter. This value can be null.
  • array $method: The method name filter. This value can be null.
  • array $expire: The lifetime time in seconds for the cached data. This value can be null.
  • array $arguments: Array that contains the list of arguments to use when generating the request ID. By default each argument is used. This value can be null.
  • array $members: Array that contains the list of class variables to use when generating the request ID. By default no class variables are used. This value can be null.
cacheRequest (line 278)

This method is called when the request matches the configurated criterias for caching, but there is no data in the cache.

  • return: True if the request is cached, false otherwise.
  • static:
  • access: public
bool cacheRequest (array &$request, array &$response)
  • array $request: The data that is associated with the callback.
  • array $response: The data that is associated with the response.
dispatch (line 185)

This method is called when the request matches the configurated criterias for caching.

If the request is cached and it's not expired then the cached response is used, otherwise the server dispatches the call and the response is cached.

  • return: True if the request is cached, false otherwise.
  • static:
  • access: public
bool dispatch (array &$request, array &$cacheData)
  • array $request: The data that is associated with the callback.
  • array $cacheData: The data that is associated with the caching criteria.
getStorage (line 69)

Retrieves an instanse to the configurated XOAD_Cache storage provider.

object Singleton &getStorage ()
initialize (line 140)

This method is called on every request to the server.

If the request matches the configurated criterias for caching this method will call XOAD_Cache::dispatch.

  • return: True if the request is cached, false otherwise.
  • static:
  • access: public
bool initialize (array &$request)
  • array $request: The data that is associated with the callback.

Documentation generated on Sat, 12 Nov 2005 20:23:51 +0200 by phpDocumentor 1.3.0RC3