Skip to content

Commit

Permalink
完善文件缓存锁机制
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jul 11, 2023
1 parent 57d0294 commit 7a2b112
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/think/cache/driver/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ public function set($name, $value, $expire = null): bool
}

$data = "<?php\n//" . sprintf('%012d', $expire) . "\n exit();?>\n" . $data;
$result = file_put_contents($filename, $data);

$result = file_put_contents($filename, $data, LOCK_EX);

if ($result) {
clearstatcache();
Expand Down

0 comments on commit 7a2b112

Please sign in to comment.