diff options
author | Jean-Luc Gyger <jean-luc.gyger@vysual.ch> | 2016-02-11 10:01:12 +0100 |
---|---|---|
committer | Jean-Luc Gyger <jean-luc.gyger@vysual.ch> | 2016-02-11 10:01:12 +0100 |
commit | d70861a8f9368773f2f0291454e9420174e6c14a (patch) | |
tree | e44a32e401211422fb05da355c9eef4d5934d9e9 /framework/Caching | |
parent | d32f65815eb6feb4bcb8a0c85572f722d7826342 (diff) | |
parent | 275f16b90a92c62935cb691d11e0bd124acf64e4 (diff) |
Merge branch 'master' of https://github.com/majuca/prado
Diffstat (limited to 'framework/Caching')
-rw-r--r-- | framework/Caching/TAPCCache.php | 6 | ||||
-rw-r--r-- | framework/Caching/TCache.php | 6 | ||||
-rw-r--r-- | framework/Caching/TDbCache.php | 6 | ||||
-rw-r--r-- | framework/Caching/TEACache.php | 2 | ||||
-rw-r--r-- | framework/Caching/TMemCache.php | 6 | ||||
-rw-r--r-- | framework/Caching/TSqliteCache.php | 6 | ||||
-rw-r--r-- | framework/Caching/TXCache.php | 6 |
7 files changed, 19 insertions, 19 deletions
diff --git a/framework/Caching/TAPCCache.php b/framework/Caching/TAPCCache.php index ec0aa35c..2274412d 100644 --- a/framework/Caching/TAPCCache.php +++ b/framework/Caching/TAPCCache.php @@ -3,9 +3,9 @@ * TAPCCache class file * * @author Alban Hanry <compte_messagerie@hotmail.com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php index 99b3f24c..4a66dd0d 100644 --- a/framework/Caching/TCache.php +++ b/framework/Caching/TCache.php @@ -3,9 +3,9 @@ * TCache and cache dependency classes. * * @author Qiang Xue <qiang.xue@gmail.com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php index c26066a2..f0cf9625 100644 --- a/framework/Caching/TDbCache.php +++ b/framework/Caching/TDbCache.php @@ -3,9 +3,9 @@ * TDbCache class file * * @author Qiang Xue <qiang.xue@gmail.com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ diff --git a/framework/Caching/TEACache.php b/framework/Caching/TEACache.php index f57011a6..251566b3 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 © 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 https://github.com/pradosoft/prado
* @copyright Copyright © 2005-2015 The PRADO Group
* @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
* @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 diff --git a/framework/Caching/TMemCache.php b/framework/Caching/TMemCache.php index c2d4901b..2b200156 100644 --- a/framework/Caching/TMemCache.php +++ b/framework/Caching/TMemCache.php @@ -4,9 +4,9 @@ * * @author Qiang Xue <qiang.xue@gmail.com> * @author Carl G. Mathisen <carlgmathisen@gmail.com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ diff --git a/framework/Caching/TSqliteCache.php b/framework/Caching/TSqliteCache.php index 3c11d45f..8451a9ea 100644 --- a/framework/Caching/TSqliteCache.php +++ b/framework/Caching/TSqliteCache.php @@ -3,9 +3,9 @@ * TSqliteCache class file * * @author Qiang Xue <qiang.xue@gmail.com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ diff --git a/framework/Caching/TXCache.php b/framework/Caching/TXCache.php index b29fd38c..19ae42ab 100644 --- a/framework/Caching/TXCache.php +++ b/framework/Caching/TXCache.php @@ -3,9 +3,9 @@ * TXCache class file * * @author Wei Zhuo <weizhuo[at]gmail[dot]com> - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2014 PradoSoft - * @license http://www.pradosoft.com/license/ + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT * @package System.Caching */ |