[#52] updated CacheLite to v1.8.3
This commit is contained in:
commit
9e03e018e5
|
|
@ -294,7 +294,7 @@ class Cache_Lite
|
|||
* @param array $options options
|
||||
* @access public
|
||||
*/
|
||||
function Cache_Lite($options = array(NULL))
|
||||
function __construct($options = array(NULL))
|
||||
{
|
||||
foreach($options as $key => $value) {
|
||||
$this->setOption($key, $value);
|
||||
|
|
@ -303,6 +303,16 @@ class Cache_Lite
|
|||
$this->setOption('cacheDir', sys_get_temp_dir() . DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -554,8 +564,7 @@ class Cache_Lite
|
|||
*/
|
||||
function raiseError($msg, $code)
|
||||
{
|
||||
include_once('PEAR.php');
|
||||
return PEAR::raiseError($msg, $code, $this->_pearErrorMode);
|
||||
error_log("[code] $msg");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -698,8 +707,10 @@ class Cache_Lite
|
|||
$this->_touchCacheFile();
|
||||
$this->_memoryCachingArray[$this->_file] = $data;
|
||||
if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
|
||||
list($key, ) = each($this->_memoryCachingArray);
|
||||
$key = key($this->_memoryCachingArray);
|
||||
next($this->_memoryCachingArray);
|
||||
unset($this->_memoryCachingArray[$key]);
|
||||
|
||||
} else {
|
||||
$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
|
||||
}
|
||||
|
|
@ -744,7 +755,7 @@ class Cache_Lite
|
|||
if ($this->_fileLocking) @flock($fp, LOCK_SH);
|
||||
clearstatcache();
|
||||
$length = @filesize($this->_file);
|
||||
$mqr = get_magic_quotes_runtime();
|
||||
$mqr = (function_exists('get_magic_quotes_runtime') ? @get_magic_quotes_runtime() : 0);
|
||||
if ($mqr) {
|
||||
set_magic_quotes_runtime(0);
|
||||
}
|
||||
|
|
@ -823,7 +834,7 @@ class Cache_Lite
|
|||
if ($this->_readControl) {
|
||||
@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) {
|
||||
set_magic_quotes_runtime(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ class Cache_Lite_File extends Cache_Lite
|
|||
* @param array $options options
|
||||
* @access public
|
||||
*/
|
||||
function Cache_Lite_File($options = array(NULL))
|
||||
function __construct($options = array(NULL))
|
||||
{
|
||||
$options['lifetime'] = 0;
|
||||
$this->Cache_Lite($options);
|
||||
parent::__construct($options);
|
||||
if (isset($options['masterFile'])) {
|
||||
$this->_masterFile = $options['masterFile'];
|
||||
} else {
|
||||
|
|
@ -65,6 +65,16 @@ class Cache_Lite_File extends Cache_Lite
|
|||
return $this->raiseError('Cache_Lite_File : Unable to read masterFile : '.$this->_masterFile, -3);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
|||
|
|
@ -81,17 +81,27 @@ class Cache_Lite_Function extends Cache_Lite
|
|||
* @param array $options options
|
||||
* @access public
|
||||
*/
|
||||
function Cache_Lite_Function($options = array(NULL))
|
||||
function __construct($options = array(NULL))
|
||||
{
|
||||
$availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
|
||||
while (list($name, $value) = each($options)) {
|
||||
foreach ($options as $name => $value) {
|
||||
if (in_array($name, $availableOptions)) {
|
||||
$property = '_'.$name;
|
||||
$this->$property = $value;
|
||||
}
|
||||
}
|
||||
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
|
||||
* @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
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
|
||||
phpunit tests/
|
||||
|
||||
To build, simply
|
||||
To build, simply execute
|
||||
|
||||
pear package
|
||||
|
||||
|
||||
## Installation
|
||||
### PEAR
|
||||
To install from scratch
|
||||
|
||||
pear install package.xml
|
||||
|
|
@ -21,3 +27,15 @@ To install from scratch
|
|||
To upgrade
|
||||
|
||||
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