diff options
author | knut <> | 2007-06-11 16:02:28 +0000 |
---|---|---|
committer | knut <> | 2007-06-11 16:02:28 +0000 |
commit | 60e6bbcc135fa21655733ff41912e5d73ba8d264 (patch) | |
tree | 48a35c0ed1b41b2f1bda277783011cd5410cf557 /framework/Caching | |
parent | 9cd30d599e11a37d74146158ee928a627fcd80a5 (diff) |
fixed #646
Diffstat (limited to 'framework/Caching')
-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');
+ }
}
/**
|