Class MachII

Description

MachII provides a convenient interface to lower-level framework classes as well as some globally useful functions.

Located in /MachII/MachII.php (line 54)


	
			
Variable Summary
mixed $_appLoader
mixed $_cache
Method Summary
MachII __construct ()
string apiVersion ()
MachII_framework_AppLoader appLoader (string $configPath, integer $configMode)
MachII_framework_AppLoader cache (string $configPath, integer $configMode, string $name, [string $container = 'MachII.cache.PhpSession'], [array $options = array()])
string version ()
void _cache ()
Variables
mixed $_appLoader (line 66)
  • static:
  • access: private
mixed $_cache (line 60)
  • static:
  • access: private
Methods
Constructor __construct (line 71)

Since this is a static class, block instantiation.

MachII __construct ()
apiVersion (line 82)

Application programming interface version number

Currently this is set to the version number of the analogous reference implementation, Mach-II for ColdFusion.

  • return: version number
  • static:
string apiVersion ()
appLoader (line 116)

Factory for creating a configured application loader.

In general this method should not be called directly; however, it is useful when implementing custom caching mechanisms and other higher level MachII_framework_AppLoader handlers.

MachII::appLoader() is called as follows:

  1. $appLoader =& MachII::appLoader($configPath, $configMode);

MachII_framework_AppLoader appLoader (string $configPath, integer $configMode)
  • string $configPath: the path and filename of the Mach-II configuration file
  • integer $configMode: the configuration reload mode
cache (line 185)

Factory for creating a caching application loader.

It is strongly recommended that some form of caching be used with Mach-II. Due to the way it functions the entire application must be present when processing an event request. There is a relatively high overhead in preparing the application for use. The use of a cache prevents the recurrance of that overhead by reusing the prepared application. In its simplest form MachII::cache() only requires three parameters:

  1. $appLoader = MachII::cache(
  2. $MACHII_CONFIG_PATH,
  3. $MACHII_CONFIG_MODE,
  4. $MACHII_APP_KEY
  5. );
This will use MachII's built in user session cache, MachII_cache_PhpSession. It is not intended for high volume applications. For better scalability, use a cache system that allows a single MachII_framework_AppLoader to be shared by multiple users.

Note: MachII_cache_PhpSession will fail silently on PHP <4.1.0. The application will NOT be cached! Use an alternate cache.

To use another cache system, install the driver in MachII/cache/ and call it by its dot notation name. Any cache driver specific options or default overrides may be passed as an associative array.

  1. $appLoader = MachII::cache(
  2. $MACHII_CONFIG_PATH,
  3. $MACHII_CONFIG_MODE,of
  4. $MACHII_APP_KEY,
  5. // use a cache driver that uses PEAR::Cache_Lite for storage
  6. 'MachII.cache.PearCacheLite',
  7. array(
  8. // override the cache directory
  9. 'cacheDir' => '/path/to/cache/dir/',
  10. // change the cache life time to 2 days
  11. 'lifeTime' => 172800
  12. )
  13. );

MachII_framework_AppLoader cache (string $configPath, integer $configMode, string $name, [string $container = 'MachII.cache.PhpSession'], [array $options = array()])
  • string $configPath: the path and filename to the Mach-II configuration file
  • integer $configMode: the configuration reload mode
  • string $name: a unique name for this Mach-II application
  • string $container: a valid container for caching the configured application
  • array $options: the cache container's configuration options
getAppManager (line 262)

Application manager

  • static:
MachII_framework_AppManager getAppManager ()
version (line 93)

Package version number

  • return: version number
  • static:
string version ()
_cache (line 236)

Shutdown method for caching application loader.

  • static:
  • access: public
void _cache ()

Documentation generated on Thu, 20 Jan 2005 10:47:34 -0800 by phpDocumentor 1.3.0RC3