hotfix cache #218

Closed
wants to merge 3 commits into
from
@@ -87,7 +87,7 @@ protected function doGetStats()
Cache::STATS_MISSES => $info['num_misses'],
Cache::STATS_UPTIME => $info['start_time'],
Cache::STATS_MEMORY_USAGE => $info['mem_size'],
- Cache::STATS_MEMORY_AVAILIABLE => $sma['avail_mem'],
+ Cache::STATS_MEMORY_AVAILABLE => $sma['avail_mem'],
);
}
}
@@ -38,8 +38,8 @@
const STATS_HITS = 'hits';
const STATS_MISSES = 'misses';
const STATS_UPTIME = 'uptime';
- const STATS_MEMORY_USAGE = 'memory_usage';
- const STATS_MEMORY_AVAILIABLE = 'memory_available';
+ const STATS_MEMORY_USAGE = 'memory_usage';
+ const STATS_MEMORY_AVAILABLE = 'memory_available';
@schmittjoh
schmittjoh Nov 16, 2012 Doctrine member

Can you keep the old constant as well for BC?

/**
* Fetches an entry from the cache.
@@ -68,7 +68,7 @@ public function __construct($directory, $extension = null)
/**
* Gets the cache directory.
- *
+ *
* @return string
*/
public function getDirectory()
@@ -78,7 +78,7 @@ public function getDirectory()
/**
* Gets the cache file extension.
- *
+ *
* @return string
*/
public function getExtension()
@@ -102,7 +102,13 @@ protected function getFilename($id)
*/
protected function doDelete($id)
{
- return @unlink($this->getFilename($id));
+ $file = $this->getFilename($id);
+
+ if (is_file($file)) {
+ return unlink($file);
+ }
+
+ return false;
}
/**
@@ -116,7 +122,9 @@ protected function doFlush()
$iterator = new \RegexIterator($iterator, $pattern);
foreach ($iterator as $name => $file) {
- @unlink($name);
+ if(is_file($name)) {
+ unlink($name);
+ }
}
return true;
@@ -115,7 +115,7 @@ protected function doGetStats()
Cache::STATS_MISSES => $stats['get_misses'],
Cache::STATS_UPTIME => $stats['uptime'],
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
- Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'],
+ Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
);
}
}
@@ -118,7 +118,7 @@ protected function doGetStats()
Cache::STATS_MISSES => $stats['get_misses'],
Cache::STATS_UPTIME => $stats['uptime'],
Cache::STATS_MEMORY_USAGE => $stats['bytes'],
- Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'],
+ Cache::STATS_MEMORY_AVAILABLE => $stats['limit_maxbytes'],
);
}
}
@@ -81,7 +81,7 @@ protected function doSave($id, $data, $lifeTime = 0)
{
$result = $this->redis->set($id, $data);
if ($lifeTime > 0) {
- $this->redis->expire($id, $lifeTime);
+ $this->redis->expire($id, $lifeTime);
}
return $result;
}
@@ -113,7 +113,7 @@ protected function doGetStats()
Cache::STATS_MISSES => false,
Cache::STATS_UPTIME => $info['uptime_in_seconds'],
Cache::STATS_MEMORY_USAGE => $info['used_memory'],
- Cache::STATS_MEMORY_AVAILIABLE => false
+ Cache::STATS_MEMORY_AVAILABLE => false
);
}
}
@@ -87,7 +87,7 @@ protected function doGetStats()
Cache::STATS_MISSES => $info['total_miss_count'],
Cache::STATS_UPTIME => $info['total_cache_uptime'],
Cache::STATS_MEMORY_USAGE => $meminfo['memory_total'],
- Cache::STATS_MEMORY_AVAILIABLE => $meminfo['memory_free'],
+ Cache::STATS_MEMORY_AVAILABLE => $meminfo['memory_free'],
);
}
}
@@ -104,7 +104,7 @@ protected function doGetStats()
Cache::STATS_MISSES => $info['misses'],
Cache::STATS_UPTIME => null,
Cache::STATS_MEMORY_USAGE => $info['size'],
- Cache::STATS_MEMORY_AVAILIABLE => $info['avail'],
+ Cache::STATS_MEMORY_AVAILABLE => $info['avail'],
);
}
}
@@ -81,7 +81,7 @@ public function testGetStats()
$this->assertArrayHasKey(Cache::STATS_MISSES, $stats);
$this->assertArrayHasKey(Cache::STATS_UPTIME, $stats);
$this->assertArrayHasKey(Cache::STATS_MEMORY_USAGE, $stats);
- $this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILIABLE, $stats);
+ $this->assertArrayHasKey(Cache::STATS_MEMORY_AVAILABLE, $stats);
}
/**