diff options
Diffstat (limited to 'framework/Caching/TAPCCache.php')
| -rw-r--r-- | framework/Caching/TAPCCache.php | 23 | 
1 files changed, 16 insertions, 7 deletions
| diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php index 969de4a4..253507b6 100644 --- a/framework/Caching/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -40,6 +40,7 @@   * </code>
   *
   * @author Alban Hanry <compte_messagerie@hotmail.com>
 + * @author Knut Urdalen <knut.urdalen@gmail.com>
   * @version $Id$
   * @package System.Caching
   * @since 3.0b
 @@ -54,12 +55,16 @@ class TAPCCache extends TCache      */
  	public function init($config)
  	{
 -		if(substr(php_sapi_name(), 0, 3) !== 'cli') //APC is usually disabled in CLI mode.
 -		{
 -			if(!extension_loaded('apc'))
 -				throw new TConfigurationException('apccache_extension_required');
 -			parent::init($config);
 -		}
 +		if(!extension_loaded('apc'))
 +			throw new TConfigurationException('apccache_extension_required');
 +				
 +		if(ini_get('apc.enabled') == false)
 +			throw new TConfigurationException('apccache_extension_not_enabled');	
 +			
 +		if(substr(php_sapi_name(), 0, 3) === 'cli' and ini_get('apc.enable_cli') == false)
 +			throw new TConfigurationException('apccache_extension_not_enabled_cli');
 +
 +		parent::init($config);
  	}
  	/**
 @@ -98,7 +103,11 @@ class TAPCCache extends TCache  	 */
  	protected function addValue($key,$value,$expire)
  	{
 -		throw new TNotSupportedException('apccache_add_unsupported');
 +		if(function_exists('apc_add')) {
 +			return apc_add($key,$value,$expire);
 +		} else {
 +			throw new TNotSupportedException('apccache_add_unsupported');
 +		}
  	}
  	/**
 | 
