Skip to content

Commit

Permalink
Adding file lock when use cache function. It will avoid errors when v…
Browse files Browse the repository at this point in the history
…iew cache is created by 2 threads concurrently.
  • Loading branch information
jrbasso committed Apr 22, 2012
1 parent 3800029 commit a233460
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/basics.php
Expand Up @@ -407,7 +407,7 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache') {
}
}
} elseif (is_writable(dirname($filename))) {
@file_put_contents($filename, $data);
@file_put_contents($filename, $data, LOCK_EX);
}
return $data;
}
Expand Down

0 comments on commit a233460

Please sign in to comment.