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 66)


	
			
Method Summary
MachII MachII ()
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()])
boolean isException (mixed $e)
string version ()
void _cache ()
Methods
Constructor MachII (line 71)

Constructor

MachII MachII ()
apiVersion (line 88)

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 126)

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);
  2. if (MachII::isException($appLoader)) {
  3. // error handling
  4. }

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 201)

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. );
  6. if (MachII::isException($appLoader)) {
  7. // error handling
  8. }
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 286)

Return the AppManager

MachII_framework_AppManager getAppManager ()
isException (line 298)

Check if a value is an exception.

  • static:
boolean isException (mixed $e)
  • mixed $e: a value to check
version (line 99)

Package version number

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

Shutdown method for caching application loader.

  • access: private
  • static:
void _cache ()

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