summaryrefslogtreecommitdiff
path: root/framework/Caching
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Caching')
-rw-r--r--framework/Caching/TAPCCache.php6
-rw-r--r--framework/Caching/TApplicationStateCacheDependency.php5
-rw-r--r--framework/Caching/TCache.php5
-rw-r--r--framework/Caching/TCacheDependency.php5
-rw-r--r--framework/Caching/TCacheDependencyList.php6
-rw-r--r--framework/Caching/TChainedCacheDependency.php5
-rw-r--r--framework/Caching/TDbCache.php5
-rw-r--r--framework/Caching/TDirectoryCacheDependency.php6
-rw-r--r--framework/Caching/TEACache.php2
-rw-r--r--framework/Caching/TFileCacheDependency.php5
-rw-r--r--framework/Caching/TGlobalStateCacheDependency.php5
-rw-r--r--framework/Caching/TMemCache.php6
-rw-r--r--framework/Caching/TSqliteCache.php6
-rw-r--r--framework/Caching/TXCache.php6
14 files changed, 46 insertions, 27 deletions
diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php
index ec0aa35c..53f1069e 100644
--- a/framework/Caching/TAPCCache.php
+++ b/framework/Caching/TAPCCache.php
@@ -6,9 +6,11 @@
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
+
/**
* TAPCCache class
*
@@ -40,7 +42,7 @@
*
* @author Alban Hanry <compte_messagerie@hotmail.com>
* @author Knut Urdalen <knut.urdalen@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.0b
*/
class TAPCCache extends TCache
diff --git a/framework/Caching/TApplicationStateCacheDependency.php b/framework/Caching/TApplicationStateCacheDependency.php
index a5a3f764..ee36ba54 100644
--- a/framework/Caching/TApplicationStateCacheDependency.php
+++ b/framework/Caching/TApplicationStateCacheDependency.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
/**
* TApplicationStateCacheDependency class.
@@ -23,7 +24,7 @@
* will be checked.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TApplicationStateCacheDependency extends TCacheDependency
diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php
index 10e28f6c..88a391c9 100644
--- a/framework/Caching/TCache.php
+++ b/framework/Caching/TCache.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
Prado::using('System.Collections.TList');
/**
@@ -41,7 +42,7 @@ Prado::using('System.Collections.TList');
* the cache acts as an array.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.0
*/
abstract class TCache extends TModule implements ICache, ArrayAccess
diff --git a/framework/Caching/TCacheDependency.php b/framework/Caching/TCacheDependency.php
index 269bedf2..7b2b1261 100644
--- a/framework/Caching/TCacheDependency.php
+++ b/framework/Caching/TCacheDependency.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
/**
* TCacheDependency class.
@@ -35,7 +36,7 @@
* - {@link TChainedCacheDependency}: checks whether any of a list of dependencies is changed or not
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
abstract class TCacheDependency extends TComponent implements ICacheDependency
diff --git a/framework/Caching/TCacheDependencyList.php b/framework/Caching/TCacheDependencyList.php
index d74ce060..6e43d428 100644
--- a/framework/Caching/TCacheDependencyList.php
+++ b/framework/Caching/TCacheDependencyList.php
@@ -6,9 +6,11 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
+
/**
* TCacheDependencyList class.
*
@@ -19,7 +21,7 @@
* for more details.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TCacheDependencyList extends TList
diff --git a/framework/Caching/TChainedCacheDependency.php b/framework/Caching/TChainedCacheDependency.php
index 463919fd..4f45cac9 100644
--- a/framework/Caching/TChainedCacheDependency.php
+++ b/framework/Caching/TChainedCacheDependency.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
/**
* TChainedCacheDependency class.
@@ -23,7 +24,7 @@
* (see {@link TList} for more details}).
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TChainedCacheDependency extends TCacheDependency
diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php
index c26066a2..968fac30 100644
--- a/framework/Caching/TDbCache.php
+++ b/framework/Caching/TDbCache.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
Prado::using('System.Data.TDbConnection');
/**
@@ -81,7 +82,7 @@ Prado::using('System.Data.TDbConnection');
* </code>
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TDbCache extends TCache
diff --git a/framework/Caching/TDirectoryCacheDependency.php b/framework/Caching/TDirectoryCacheDependency.php
index 66f7393d..d78aa87a 100644
--- a/framework/Caching/TDirectoryCacheDependency.php
+++ b/framework/Caching/TDirectoryCacheDependency.php
@@ -6,9 +6,11 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
+
/**
* TDirectoryCacheDependency class.
*
@@ -24,7 +26,7 @@
* to a certain depth of the subdirectories.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TDirectoryCacheDependency extends TCacheDependency
diff --git a/framework/Caching/TEACache.php b/framework/Caching/TEACache.php
index f57011a6..073b7f79 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-2014 PradoSoft * @license http://www.pradosoft.com/license/ * @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> * @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/ * @package Prado\Caching */ namespace Prado\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> * @package Prado\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/TFileCacheDependency.php b/framework/Caching/TFileCacheDependency.php
index 4a4694bd..e8f1c2fd 100644
--- a/framework/Caching/TFileCacheDependency.php
+++ b/framework/Caching/TFileCacheDependency.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
/**
* TFileCacheDependency class.
@@ -19,7 +20,7 @@
* last modification time remains unchanged.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TFileCacheDependency extends TCacheDependency
diff --git a/framework/Caching/TGlobalStateCacheDependency.php b/framework/Caching/TGlobalStateCacheDependency.php
index daae990e..b10b5e01 100644
--- a/framework/Caching/TGlobalStateCacheDependency.php
+++ b/framework/Caching/TGlobalStateCacheDependency.php
@@ -6,9 +6,10 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
/**
* TGlobalStateCacheDependency class.
@@ -19,7 +20,7 @@
* set {@link setStateName StateName} to the name of the global state.
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.0
*/
class TGlobalStateCacheDependency extends TCacheDependency
diff --git a/framework/Caching/TMemCache.php b/framework/Caching/TMemCache.php
index c2d4901b..8c92bab1 100644
--- a/framework/Caching/TMemCache.php
+++ b/framework/Caching/TMemCache.php
@@ -7,9 +7,11 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
+
/**
* TMemCache class
*
@@ -76,7 +78,7 @@
* NB : MemCache server(s) must be restarted to apply settings. Require (PECL memcache >= 2.0.0).
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.0
*/
class TMemCache extends TCache
diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php
index 3c11d45f..12d3e225 100644
--- a/framework/Caching/TSqliteCache.php
+++ b/framework/Caching/TSqliteCache.php
@@ -6,9 +6,11 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
+
/**
* TSqliteCache class
*
@@ -66,7 +68,7 @@
* SQLite DB file (in the namespace format).
*
* @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.0
*/
class TSqliteCache extends TCache
diff --git a/framework/Caching/TXCache.php b/framework/Caching/TXCache.php
index b29fd38c..96af68f5 100644
--- a/framework/Caching/TXCache.php
+++ b/framework/Caching/TXCache.php
@@ -6,9 +6,11 @@
* @link http://www.pradosoft.com/
* @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @package System.Caching
+ * @package Prado\Caching
*/
+namespace Prado\Caching;
+
/**
* TXCache class
*
@@ -36,7 +38,7 @@
* </code>
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @package System.Caching
+ * @package Prado\Caching
* @since 3.1.1
*/
class TXCache extends TCache