summaryrefslogtreecommitdiff
path: root/framework/Caching
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Caching')
-rw-r--r--framework/Caching/TAPCCache.php8
-rw-r--r--framework/Caching/TCache.php2
-rw-r--r--framework/Caching/TDbCache.php2
-rw-r--r--framework/Caching/TEACache.php2
-rw-r--r--framework/Caching/TMemCache.php26
-rw-r--r--framework/Caching/TSqliteCache.php2
-rw-r--r--framework/Caching/TXCache.php2
7 files changed, 22 insertions, 22 deletions
diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php
index 8826fac6..cdfc89d6 100644
--- a/framework/Caching/TAPCCache.php
+++ b/framework/Caching/TAPCCache.php
@@ -4,7 +4,7 @@
*
* @author Alban Hanry <compte_messagerie@hotmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TAPCCache.php 3281 2013-03-13 21:01:40Z ctrlaltca $
* @package System.Caching
@@ -57,10 +57,10 @@ class TAPCCache extends TCache
{
if(!extension_loaded('apc'))
throw new TConfigurationException('apccache_extension_required');
-
+
if(ini_get('apc.enabled') == false)
- throw new TConfigurationException('apccache_extension_not_enabled');
-
+ 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');
diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php
index 0a0ca2db..99762bd9 100644
--- a/framework/Caching/TCache.php
+++ b/framework/Caching/TCache.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TCache.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Caching
diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php
index 03c6f54f..d41edd09 100644
--- a/framework/Caching/TDbCache.php
+++ b/framework/Caching/TDbCache.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TDbCache.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Caching
diff --git a/framework/Caching/TEACache.php b/framework/Caching/TEACache.php
index 6a20f63b..6726547d 100644
--- a/framework/Caching/TEACache.php
+++ b/framework/Caching/TEACache.php
@@ -1 +1 @@
-<?php /** * TEACache class file * * @author Dario rigolin <drigolin@e-portaltech.it> * @link http://www.pradosoft.com/ * @copyright Copyright &copy; 2005-2013 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id: TEACache.php 3281 2013-03-13 19:31:03Z xue $ * @package System.Caching */ /** * TEACache class * * TEACache implements a cache application module based on {@link http://eaccelerator.net/ eAccelerator}. * * By definition, cache does not ensure the existence of a value * even if it never expires. Cache is not meant to be an persistent storage. * * To use this module, the eAccelerator PHP extension must be loaded and enabled * * Please note that as of v0.9.6, eAccelerator no longer supports data caching. * This means if you still want to use this component, your eAccelerator should be of 0.9.5.x or lower version. * * Some usage examples of TEACache are as follows, * <code> * $cache=new TEACache; // TEACache may also be loaded as a Prado application module * $cache->init(null); * $cache->add('object',$object); * $object2=$cache->get('object'); * </code> * * If loaded, TEACache will register itself with {@link TApplication} as the * cache module. It can be accessed via {@link TApplication::getCache()}. * * TEACache may be configured in application configuration file as follows * <code> * <module id="cache" class="System.Caching.TEACache" /> * </code> * * @author Dario Rigolin <drigolin@e-portaltech.it> * @version $Id: TEACache.php 3281 2013-03-13 19:31:03Z xue $ * @package System.Caching * @since 3.2.2 */ class TEACache extends TCache { /** * Initializes this module. * This method is required by the IModule interface. * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if eaccelerator extension is not installed or not started, check your php.ini */ public function init($config) { if(!function_exists('eaccelerator_get')) throw new TConfigurationException('eacceleratorcache_extension_required'); parent::init($config); } /** * Retrieves a value from cache with a specified key. * This is the implementation of the method declared in the parent class. * @param string a unique key identifying the cached value * @return string the value stored in cache, false if the value is not in the cache or expired. */ protected function getValue($key) { $value = eaccelerator_get($key); return ($value === null) ? false : $value; } /** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function setValue($key,$value,$expire) { return eaccelerator_put($key,$value,$expire); } /** * Stores a value identified by a key into cache if the cache does not contain this key. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function addValue($key,$value,$expire) { return (null === eaccelerator_get($key)) ? $this->setValue($key,$value,$expire) : false; } /** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return eaccelerator_rm($key); } /** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { // first, remove expired content from cache eaccelerator_gc(); // now, remove leftover cache-keys $keys = eaccelerator_list_keys(); foreach($keys as $key) $this->deleteValue(substr($key['name'], 1)); return true; } } \ No newline at end of file
+<?php /** * TEACache class file * * @author Dario rigolin <drigolin@e-portaltech.it> * @link http://www.pradosoft.com/ * @copyright Copyright &copy; 2005-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id: TEACache.php 3281 2013-03-13 19:31:03Z xue $ * @package System.Caching */ /** * TEACache class * * TEACache implements a cache application module based on {@link http://eaccelerator.net/ eAccelerator}. * * By definition, cache does not ensure the existence of a value * even if it never expires. Cache is not meant to be an persistent storage. * * To use this module, the eAccelerator PHP extension must be loaded and enabled * * Please note that as of v0.9.6, eAccelerator no longer supports data caching. * This means if you still want to use this component, your eAccelerator should be of 0.9.5.x or lower version. * * Some usage examples of TEACache are as follows, * <code> * $cache=new TEACache; // TEACache may also be loaded as a Prado application module * $cache->init(null); * $cache->add('object',$object); * $object2=$cache->get('object'); * </code> * * If loaded, TEACache will register itself with {@link TApplication} as the * cache module. It can be accessed via {@link TApplication::getCache()}. * * TEACache may be configured in application configuration file as follows * <code> * <module id="cache" class="System.Caching.TEACache" /> * </code> * * @author Dario Rigolin <drigolin@e-portaltech.it> * @version $Id: TEACache.php 3281 2013-03-13 19:31:03Z xue $ * @package System.Caching * @since 3.2.2 */ class TEACache extends TCache { /** * Initializes this module. * This method is required by the IModule interface. * @param TXmlElement configuration for this module, can be null * @throws TConfigurationException if eaccelerator extension is not installed or not started, check your php.ini */ public function init($config) { if(!function_exists('eaccelerator_get')) throw new TConfigurationException('eacceleratorcache_extension_required'); parent::init($config); } /** * Retrieves a value from cache with a specified key. * This is the implementation of the method declared in the parent class. * @param string a unique key identifying the cached value * @return string the value stored in cache, false if the value is not in the cache or expired. */ protected function getValue($key) { $value = eaccelerator_get($key); return ($value === null) ? false : $value; } /** * Stores a value identified by a key in cache. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function setValue($key,$value,$expire) { return eaccelerator_put($key,$value,$expire); } /** * Stores a value identified by a key into cache if the cache does not contain this key. * This is the implementation of the method declared in the parent class. * * @param string the key identifying the value to be cached * @param string the value to be cached * @param integer the number of seconds in which the cached value will expire. 0 means never expire. * @return boolean true if the value is successfully stored into cache, false otherwise */ protected function addValue($key,$value,$expire) { return (null === eaccelerator_get($key)) ? $this->setValue($key,$value,$expire) : false; } /** * Deletes a value with the specified key from cache * This is the implementation of the method declared in the parent class. * @param string the key of the value to be deleted * @return boolean if no error happens during deletion */ protected function deleteValue($key) { return eaccelerator_rm($key); } /** * Deletes all values from cache. * Be careful of performing this operation if the cache is shared by multiple applications. */ public function flush() { // first, remove expired content from cache eaccelerator_gc(); // now, remove leftover cache-keys $keys = eaccelerator_list_keys(); foreach($keys as $key) $this->deleteValue(substr($key['name'], 1)); return true; } } \ No newline at end of file
diff --git a/framework/Caching/TMemCache.php b/framework/Caching/TMemCache.php
index 8d2e6a4b..173d0f7c 100644
--- a/framework/Caching/TMemCache.php
+++ b/framework/Caching/TMemCache.php
@@ -5,7 +5,7 @@
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Carl G. Mathisen <carlgmathisen@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TMemCache.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Caching
@@ -109,11 +109,11 @@ class TMemCache extends TCache
private $_persistence = true;
/**
* @var integer number of buckets to create for this server which in turn control its
- * probability of it being selected. The probability is relative to the total weight
+ * probability of it being selected. The probability is relative to the total weight
* of all servers.
*/
private $_weight = 1;
-
+
private $_timeout = 360;
private $_retryInterval = 15;
@@ -126,9 +126,9 @@ class TMemCache extends TCache
* @var float Specifies the minimum amount of savings to actually store the value compressed. The supplied value must be between 0 and 1. Default value is 0.2 giving a minimum 20% compression savings.
*/
private $_minSavings=0.0;
-
+
private $_status = true;
-
+
private $_failureCallback = null;
/**
@@ -176,13 +176,13 @@ class TMemCache extends TCache
Prado::trace('Adding server '.$this->_host, 'System.Caching.TMemCache');
if($this->_cache->addServer($this->_host,$this->_port)===false)
throw new TConfigurationException('memcache_connection_failed',$this->_host,$this->_port);
- }
+ }
if($this->_threshold!==0)
- $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings);
+ $this->_cache->setCompressThreshold($this->_threshold,$this->_minSavings);
$this->_initialized=true;
parent::init($config);
}
-
+
/**
* Loads configuration from an XML element
* @param TXmlElement configuration node
@@ -209,7 +209,7 @@ class TMemCache extends TCache
);
foreach($checks as $property=>$exception)
{
- $value=$properties->remove($property);
+ $value=$properties->remove($property);
if($value!==null && is_numeric($value))
$server[$property]=$value;
else if($value!==null)
@@ -268,7 +268,7 @@ class TMemCache extends TCache
{
return $this->_threshold;
}
-
+
/**
* @param integer minimum value length before attempting to compress
* @throws TInvalidOperationException if the module is already initialized
@@ -280,7 +280,7 @@ class TMemCache extends TCache
else
$this->_threshold=TPropertyValue::ensureInteger($value);
}
-
+
/**
* @return float minimum amount of savings to actually store the value compressed
*/
@@ -288,7 +288,7 @@ class TMemCache extends TCache
{
return $this->_minSavings;
}
-
+
/**
* @param float minimum amount of savings to actually store the value compressed
* @throws TInvalidOperationException if the module is already initialized
@@ -300,7 +300,7 @@ class TMemCache extends TCache
else
$this->_minSavings=TPropertyValue::ensureFloat($value);
}
-
+
/**
* Retrieves a value from cache with a specified key.
* This is the implementation of the method declared in the parent class.
diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php
index ae040028..ab964222 100644
--- a/framework/Caching/TSqliteCache.php
+++ b/framework/Caching/TSqliteCache.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TSqliteCache.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Caching
diff --git a/framework/Caching/TXCache.php b/framework/Caching/TXCache.php
index e86c8fa9..c06db91e 100644
--- a/framework/Caching/TXCache.php
+++ b/framework/Caching/TXCache.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TXCache.php 1994 2007-06-11 16:02:28Z knut $
* @package System.Caching