diff --git a/src/Cache/Adapter/Filesystem.php b/src/Cache/Adapter/Filesystem.php index 43fb5ed631..02c8649de9 100644 --- a/src/Cache/Adapter/Filesystem.php +++ b/src/Cache/Adapter/Filesystem.php @@ -106,7 +106,13 @@ class Filesystem implements Adapter { $file = $this->getPath($key); - return file_exists($file) && touch($file); + if (! file_exists($file) || ! touch($file)) { + return false; + } + + clearstatcache(true, $file); + + return true; } /** diff --git a/tests/Cache/Base.php b/tests/Cache/Base.php index d5f9f013ba..4fd13cb62e 100644 --- a/tests/Cache/Base.php +++ b/tests/Cache/Base.php @@ -62,11 +62,11 @@ abstract class Base extends TestCase $result = self::$cache->save('touch-key', 'touch data', 'touch-key'); $this->assertEquals('touch data', $result); - sleep(2); + sleep(3); - $this->assertEquals(false, self::$cache->load('touch-key', 1, 'touch-key')); + $this->assertEquals(false, self::$cache->load('touch-key', 2, 'touch-key')); $this->assertEquals(true, self::$cache->touch('touch-key', 'touch-key')); - $this->assertEquals('touch data', self::$cache->load('touch-key', 1, 'touch-key')); + $this->assertEquals('touch data', self::$cache->load('touch-key', 2, 'touch-key')); $this->assertEquals(false, self::$cache->touch('missing-touch-key', 'missing-touch-key')); self::$cache->purge('touch-key');