Skip to content
Permalink
Browse files

Port optimizations from #6232

Port the code optimizations without the method renames and readability
changes.
  • Loading branch information...
markstory committed Apr 2, 2015
1 parent 6d4e5d2 commit 298aaf5b07ef918d176fb6b47bf8197aeb6ddaef
Showing with 4 additions and 11 deletions.
  1. +3 −7 src/Cache/Engine/FileEngine.php
  2. +1 −4 src/Core/ObjectRegistry.php
@@ -294,11 +294,10 @@ public function clear($check)
*/
protected function _clearDirectory($path, $now, $threshold)
{
$prefixLength = strlen($this->_config['prefix']);
if (!is_dir($path)) {
return;
}
$prefixLength = strlen($this->_config['prefix']);
$dir = dir($path);
while (($entry = $dir->read()) !== false) {
@@ -314,12 +313,11 @@ protected function _clearDirectory($path, $now, $threshold)
if ($threshold) {
$mtime = $file->getMTime();
if ($mtime > $threshold) {
continue;
}
$expires = (int)$file->current();
$expires = (int)$file->current();
if ($expires > $now) {
continue;
}
@@ -395,9 +393,7 @@ protected function _setKey($key, $createKey = false)
}
unset($path);
if (!$exists &&
!chmod($this->_File->getPathname(), (int)$this->_config['mask'])
) {
if (!$exists && !chmod($this->_File->getPathname(), (int)$this->_config['mask'])) {
trigger_error(sprintf(
'Could not apply permission mask "%s" on cache file "%s"',
$this->_File->getPathname(),
@@ -110,10 +110,7 @@ protected function _checkDuplicate($name, $config)
{
$existing = $this->_loaded[$name];
$msg = sprintf('The "%s" alias has already been loaded', $name);
$hasConfig = false;
if (method_exists($existing, 'config')) {
$hasConfig = true;
}
$hasConfig = method_exists($existing, 'config');
if (!$hasConfig) {
throw new RuntimeException($msg);
}

0 comments on commit 298aaf5

Please sign in to comment.
You can’t perform that action at this time.