Browse Source

Adding file lock when use cache function. It will avoid errors when view cache is created by 2 threads concurrently.

Juan Basso 14 years ago
parent
commit
a233460c7f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lib/Cake/basics.php

+ 1 - 1
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;
 }