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

This commit is contained in:
Juan Basso 2012-04-21 21:01:58 -04:00
parent 3800029c9a
commit a233460c7f

View file

@ -407,7 +407,7 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache') {
} }
} }
} elseif (is_writable(dirname($filename))) { } elseif (is_writable(dirname($filename))) {
@file_put_contents($filename, $data); @file_put_contents($filename, $data, LOCK_EX);
} }
return $data; return $data;
} }