<?php
    
   /**
    * \ingroup Cache
    *
    * Provides a singleton for storing and retrieving data from a global cache. You probably
    * want to use the getCache() method in this class instead of creating objects of the Cache
    * class.
    *
    * @see Cache
    */
    class CacheManager 
    {
        var $cache;

		/**
		 * Returns an instance of the cache.
		 *
		 * @param cacheEnabled Set this to false if you wish this class to always return no data,
		 * meaning that it will have to be loaded every time.
		 * @return The current global instance of the Cache class
		 */
        function &getCache( $cacheEnabled = true )
        {
            static $cache;

            if( $cache == null ) {
                // source the neccessary files
                require_once( PLOG_CLASS_PATH . "class/cache/cache.class.php" );
                require_once( PLOG_CLASS_PATH . "class/config/config.class.php" );

                // define defaults
                $cacheParameter = array(
                    'cacheDir' => "./tmp/",
                    'lifeTime' => 604800,
                    'readControl' => false,
                    'automaticSerialization' => true,
                    'hashedDirectoryLevel' => 2,
					'caching' => $cacheEnabled
                );

                // build a new cache object
                $cache =& new Cache( $cacheParameter);
            }
            return $cache;
        }
    }
?>