diff --git a/lib/Cake/Cache/Engine/FileEngine.php b/lib/Cake/Cache/Engine/FileEngine.php index f81889dcb..6839f9ab2 100644 --- a/lib/Cake/Cache/Engine/FileEngine.php +++ b/lib/Cake/Cache/Engine/FileEngine.php @@ -66,7 +66,7 @@ class FileEngine extends CacheEngine { public function init($settings = array()) { parent::init(array_merge( array( - 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false, + 'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> true, 'serialize'=> true, 'isWindows' => false ), $settings @@ -162,6 +162,9 @@ class FileEngine extends CacheEngine { $cachetime = intval($this->_File->current()); if ($cachetime !== false && ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime)) { + if ($this->settings['lock']) { + $this->_File->flock(LOCK_UN); + } return false; } diff --git a/lib/Cake/Test/Case/Cache/CacheTest.php b/lib/Cake/Test/Case/Cache/CacheTest.php index 1877bd20e..0aed3f1a0 100644 --- a/lib/Cake/Test/Case/Cache/CacheTest.php +++ b/lib/Cake/Test/Case/Cache/CacheTest.php @@ -197,7 +197,7 @@ class CacheTest extends CakeTestCase { $expected = array( 'path' => TMP . 'sessions' . DS, 'prefix' => 'cake_', - 'lock' => false, + 'lock' => true, 'serialize' => true, 'duration' => 3600, 'probability' => 100,