cvs: pear /Cache_Lite Cache_Lite.php
| From: | Fabien MARTY | Date: | Fri, 16 Aug 2002 10:07:40 +0000 |
| Subject: | cvs: pear /Cache_Lite Cache_Lite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5770@lists.php.net to get a copy of this message | ||
fab Fri Aug 16 06:07:40 2002 EDT
Modified files:
/pear/Cache_Lite Cache_Lite.php
Log:
Add '$doNotTestCacheValidity' optional parameter for the get() method
Index: pear/Cache_Lite/Cache_Lite.php
diff -u pear/Cache_Lite/Cache_Lite.php:1.9 pear/Cache_Lite/Cache_Lite.php:1.10
--- pear/Cache_Lite/Cache_Lite.php:1.9 Fri Aug 16 05:44:41 2002
+++ pear/Cache_Lite/Cache_Lite.php Fri Aug 16 06:07:40 2002
@@ -11,7 +11,7 @@
* Technical choices are described in the 'docs/technical' file
*
* @package Cache_Lite
-* @version $Id: Cache_Lite.php,v 1.9 2002/08/16 09:44:41 fab Exp $
+* @version $Id: Cache_Lite.php,v 1.10 2002/08/16 10:07:40 fab Exp $
* @author Fabien MARTY <fab@php.net>
*/
@@ -160,17 +160,24 @@
*
* @param string $id cache id
* @param string $group name of the cache group
+ * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be
tested
* @return string data of the cache (or false if no cache available)
* @access public
*/
- function get($id, $group = 'default')
+ function get($id, $group = 'default', $doNotTestCacheValidity = false)
{
$this->_id = $id;
$this->_group = $group;
if ($this->_caching) {
$this->_setFileName($id, $group);
- if (@filemtime($this->_file) > $this->_refreshTime) {
- return (($data = $this->_read()));
+ if ($doNotTestCacheValidity) {
+ if (file_exists($this->_file)) {
+ return (($data = $this->_read()));
+ }
+ } else {
+ if (@filemtime($this->_file) > $this->_refreshTime) {
+ return (($data = $this->_read()));
+ }
}
}
return false;