Skip to content

Commit

Permalink
Lower times to resolve windows issues.
Browse files Browse the repository at this point in the history
* Lower the duration and sleep() time to reduce issues on windows.
* Clearing the file handle out fixes issues on windows where file
  handles would persist after the file was deleted.
  • Loading branch information
markstory committed Jul 26, 2014
1 parent 7b0179b commit c45868e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Cache/Engine/FileEngine.php
Expand Up @@ -152,6 +152,7 @@ public function write($key, $data) {
if ($this->_config['lock']) {
$this->_File->flock(LOCK_UN);
}
$this->_File = null;

return $success;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Cache/Engine/FileEngineTest.php
Expand Up @@ -191,7 +191,7 @@ public function testSerialize() {
* @return void
*/
public function testClear() {
$this->_configCache(['duration' => 1]);
$this->_configCache(['duration' => 0]);

$data = 'this is a test of the emergency broadcasting system';
Cache::write('serialize_test1', $data, 'file_test');
Expand All @@ -201,7 +201,7 @@ public function testClear() {
$this->assertTrue(file_exists(TMP . 'tests/cake_serialize_test2'));
$this->assertTrue(file_exists(TMP . 'tests/cake_serialize_test3'));

sleep(2);
sleep(1);
$result = Cache::clear(true, 'file_test');
$this->assertTrue($result);
$this->assertFalse(file_exists(TMP . 'tests/cake_serialize_test1'));
Expand Down

0 comments on commit c45868e

Please sign in to comment.