pluf2

pluf2 Commit Details


Date:2008-11-17 06:41:36 (16 years 1 month ago)
Author:Loic d'Anterroches
Branch:master
Commit:42d7f1bee48e64d88b6523ca19e389a8621c2349
Parents: 49e5d563e55a285c879ea76e16930b577e9450f0
Message:Fixed possible concurrency errors.

Ignore problems when trying to remove a file as it can already be
removed.
Write with exclusive lock the data in the cache.
Changes:

File differences

src/Pluf/Cache/File.php
5151
5252
5353
54
54
5555
5656
5757
......
6767
6868
6969
70
70
7171
7272
7373
if ($timeout == null) $timeout = Pluf::f('cache_timeout', 300);
if (!file_exists($dir)) mkdir($dir, 0777, true);
$expire = time()+$timeout;
file_put_contents($fname, $expire."\n".serialize($value));
file_put_contents($fname, $expire."\n".serialize($value), LOCK_EX);
}
/**
if (!file_exists($fname)) return $default;
list($timeout, $content) = explode("\n", file_get_contents($fname), 2);
if ($timeout < time()) {
unlink($fname);
@unlink($fname);
return $default;
}
return unserialize($content);

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05261s using 13 queries.