Skip to content
Browse files

Adding file lock when use cache function. It will avoid errors when v…

…iew cache is created by 2 threads concurrently.
  • Loading branch information...
1 parent 3800029 commit a233460c7fa2917950888cd6cd75aa3f06493a96 @jrbasso jrbasso committed Apr 21, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/basics.php
View
2 lib/Cake/basics.php
@@ -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;
}

0 comments on commit a233460

Please sign in to comment.
Something went wrong with that request. Please try again.