[pLog-svn] r4302 -
plog/branches/lifetype-1.1.3/class/cache/Cache_Lite
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Thu Nov 16 01:54:29 GMT 2006
Author: jondaley
Date: 2006-11-16 01:54:28 +0000 (Thu, 16 Nov 2006)
New Revision: 4302
Modified:
plog/branches/lifetype-1.1.3/class/cache/Cache_Lite/Lite.php
Log:
our changes. Anyone know if the is_dir call is needed? And does the @unlink fail if the file doesn't exist?
Modified: plog/branches/lifetype-1.1.3/class/cache/Cache_Lite/Lite.php
===================================================================
--- plog/branches/lifetype-1.1.3/class/cache/Cache_Lite/Lite.php 2006-11-16 01:53:34 UTC (rev 4301)
+++ plog/branches/lifetype-1.1.3/class/cache/Cache_Lite/Lite.php 2006-11-16 01:54:28 UTC (rev 4302)
@@ -1,6 +1,10 @@
<?php
+include_once( PLOG_CLASS_PATH."class/object/loggable.class.php" );
+
/**
+* \ingroup Cache
+*
* Fast, light and safe Cache Class
*
* Cache_Lite is a fast, light and safe cache system. It's optimized
@@ -26,7 +30,7 @@
define('CACHE_LITE_ERROR_RETURN', 1);
define('CACHE_LITE_ERROR_DIE', 8);
-class Cache_Lite
+class Cache_Lite extends Loggable
{
// --- Private properties ---
@@ -279,6 +283,7 @@
*/
function Cache_Lite($options = array(NULL))
{
+ $this->Loggable();
foreach($options as $key => $value) {
$this->setOption($key, $value);
}
@@ -533,8 +538,7 @@
*/
function raiseError($msg, $code)
{
- include_once('PEAR.php');
- return PEAR::raiseError($msg, $code, $this->_pearErrorMode);
+ $this->log->error($msg, LOGGER_PRIO_ERROR);
}
/**
@@ -574,7 +578,7 @@
*/
function _unlink($file)
{
- if (!@unlink($file)) {
+ if (file_exists($file) && !@unlink($file)) {
return $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
}
return true;
@@ -626,7 +630,7 @@
}
}
break;
- case 'notingrou':
+ case 'notingroup':
if (!strpos($file2, $motif, 0)) {
$result = ($result and ($this->_unlink($file2)));
}
@@ -749,7 +753,7 @@
*/
function _write($data)
{
- if ($this->_hashedDirectoryLevel > 0) {
+ if (!is_dir(dirname($this->_file)) && $this->_hashedDirectoryLevel > 0) {
$hash = md5($this->_fileName);
$root = $this->_cacheDir;
for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
More information about the pLog-svn
mailing list