[#52] updated CacheLite to v1.8.3
This commit is contained in:
parent
d967a3febe
commit
be59f15252
|
|
@ -294,7 +294,7 @@ class Cache_Lite
|
||||||
* @param array $options options
|
* @param array $options options
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function Cache_Lite($options = array(NULL))
|
function __construct($options = array(NULL))
|
||||||
{
|
{
|
||||||
foreach($options as $key => $value) {
|
foreach($options as $key => $value) {
|
||||||
$this->setOption($key, $value);
|
$this->setOption($key, $value);
|
||||||
|
|
@ -304,6 +304,16 @@ class Cache_Lite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP4 constructor for backwards compatibility with older code
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
*/
|
||||||
|
function Cache_Lite($options = array(NULL))
|
||||||
|
{
|
||||||
|
self::__construct($options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic way to set a Cache_Lite option
|
* Generic way to set a Cache_Lite option
|
||||||
*
|
*
|
||||||
|
|
@ -698,8 +708,10 @@ class Cache_Lite
|
||||||
$this->_touchCacheFile();
|
$this->_touchCacheFile();
|
||||||
$this->_memoryCachingArray[$this->_file] = $data;
|
$this->_memoryCachingArray[$this->_file] = $data;
|
||||||
if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
|
if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
|
||||||
list($key, ) = each($this->_memoryCachingArray);
|
$key = key($this->_memoryCachingArray);
|
||||||
|
next($this->_memoryCachingArray);
|
||||||
unset($this->_memoryCachingArray[$key]);
|
unset($this->_memoryCachingArray[$key]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
|
$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
|
||||||
}
|
}
|
||||||
|
|
@ -744,7 +756,7 @@ class Cache_Lite
|
||||||
if ($this->_fileLocking) @flock($fp, LOCK_SH);
|
if ($this->_fileLocking) @flock($fp, LOCK_SH);
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
$length = @filesize($this->_file);
|
$length = @filesize($this->_file);
|
||||||
$mqr = get_magic_quotes_runtime();
|
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
|
||||||
if ($mqr) {
|
if ($mqr) {
|
||||||
set_magic_quotes_runtime(0);
|
set_magic_quotes_runtime(0);
|
||||||
}
|
}
|
||||||
|
|
@ -823,7 +835,7 @@ class Cache_Lite
|
||||||
if ($this->_readControl) {
|
if ($this->_readControl) {
|
||||||
@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
|
@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
|
||||||
}
|
}
|
||||||
$mqr = get_magic_quotes_runtime();
|
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
|
||||||
if ($mqr) {
|
if ($mqr) {
|
||||||
set_magic_quotes_runtime(0);
|
set_magic_quotes_runtime(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ class Cache_Lite_File extends Cache_Lite
|
||||||
* @param array $options options
|
* @param array $options options
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function Cache_Lite_File($options = array(NULL))
|
function __construct($options = array(NULL))
|
||||||
{
|
{
|
||||||
$options['lifetime'] = 0;
|
$options['lifetime'] = 0;
|
||||||
$this->Cache_Lite($options);
|
parent::__construct($options);
|
||||||
if (isset($options['masterFile'])) {
|
if (isset($options['masterFile'])) {
|
||||||
$this->_masterFile = $options['masterFile'];
|
$this->_masterFile = $options['masterFile'];
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -66,6 +66,16 @@ class Cache_Lite_File extends Cache_Lite
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP4 constructor for backwards compatibility with older code
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
*/
|
||||||
|
function Cache_Lite_File($options = array(NULL))
|
||||||
|
{
|
||||||
|
self::__construct($options);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if a cache is available and (if yes) return it
|
* Test if a cache is available and (if yes) return it
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -81,17 +81,27 @@ class Cache_Lite_Function extends Cache_Lite
|
||||||
* @param array $options options
|
* @param array $options options
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function Cache_Lite_Function($options = array(NULL))
|
function __construct($options = array(NULL))
|
||||||
{
|
{
|
||||||
$availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
|
$availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
|
||||||
while (list($name, $value) = each($options)) {
|
foreach ($options as $name => $value) {
|
||||||
if (in_array($name, $availableOptions)) {
|
if (in_array($name, $availableOptions)) {
|
||||||
$property = '_'.$name;
|
$property = '_'.$name;
|
||||||
$this->$property = $value;
|
$this->$property = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reset($options);
|
reset($options);
|
||||||
$this->Cache_Lite($options);
|
parent::__construct($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP4 constructor for backwards compatibility with older code
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
*/
|
||||||
|
function Cache_Lite_Function($options = array(NULL))
|
||||||
|
{
|
||||||
|
self::__construct($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,19 @@ class Cache_Lite_Output extends Cache_Lite
|
||||||
* @param array $options options
|
* @param array $options options
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function Cache_Lite_Output($options)
|
function __construct($options)
|
||||||
{
|
{
|
||||||
$this->Cache_Lite($options);
|
parent::__construct($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP4 constructor for backwards compatibility with older code
|
||||||
|
*
|
||||||
|
* @param array $options Options
|
||||||
|
*/
|
||||||
|
function Cache_Lite_Output($options = array(NULL))
|
||||||
|
{
|
||||||
|
self::__construct($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,25 @@
|
||||||
# PEAR Cache_Lite
|
# PEAR Cache_Lite
|
||||||
|
|
||||||
|
Fast and safe little cache system.
|
||||||
|
|
||||||
|
This package is a little cache system optimized for file containers.
|
||||||
|
t is fast and safe (because it uses file locking and/or anti-corruption tests).
|
||||||
|
|
||||||
[](https://travis-ci.org/pear/Cache_Lite)
|
[](https://travis-ci.org/pear/Cache_Lite)
|
||||||
|
|
||||||
This package is [Cache_Lite](http://pear.php.net/package/Cache_Lite).
|
|
||||||
|
|
||||||
Please report all new issues via the [PEAR bug tracker](http://pear.php.net/bugs/).
|
|
||||||
|
|
||||||
|
## Building
|
||||||
To test this package, run
|
To test this package, run
|
||||||
|
|
||||||
phpunit tests/
|
phpunit tests/
|
||||||
|
|
||||||
To build, simply
|
To build, simply execute
|
||||||
|
|
||||||
pear package
|
pear package
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
### PEAR
|
||||||
To install from scratch
|
To install from scratch
|
||||||
|
|
||||||
pear install package.xml
|
pear install package.xml
|
||||||
|
|
@ -21,3 +27,15 @@ To install from scratch
|
||||||
To upgrade
|
To upgrade
|
||||||
|
|
||||||
pear upgrade -f package.xml
|
pear upgrade -f package.xml
|
||||||
|
|
||||||
|
### Composer
|
||||||
|
|
||||||
|
composer require pear/cache_lite
|
||||||
|
|
||||||
|
|
||||||
|
## Links
|
||||||
|
- Homepage: http://pear.php.net/package/Cache_Lite
|
||||||
|
- Source code: https://github.com/pear/Cache_Lite
|
||||||
|
- Issue tracker: http://pear.php.net/bugs/search.php?cmd=display&package_name[]=Cache_Lite
|
||||||
|
- Unit test status: https://travis-ci.org/pear/Cache_Lite
|
||||||
|
- Packagist: https://packagist.org/packages/pear/cache_lite
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue