Skip to content

Commit

Permalink
A bit of refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vajexal committed Oct 28, 2020
1 parent 49e7950 commit 4eda66e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/StatCache.php
Expand Up @@ -67,6 +67,11 @@ public static function set(string $path, array $stat): void
self::$timeouts[$path] = self::$now + self::$ttl;
}

public static function getTtl(): int
{
return self::$ttl;
}

public static function ttl(int $seconds): void
{
self::$ttl = $seconds;
Expand Down
6 changes: 5 additions & 1 deletion test/StatCacheTest.php
Expand Up @@ -8,18 +8,22 @@

class StatCacheTest extends FilesystemTest
{
private $ttlBackup;

protected function setUp(): void
{
parent::setUp();

$this->ttlBackup = StatCache::getTtl();

StatCache::ttl(1);
}

protected function tearDown(): void
{
parent::tearDown();

StatCache::ttl(3);
StatCache::ttl($this->ttlBackup);
}

public function testStatCacheExpiration()
Expand Down

0 comments on commit 4eda66e

Please sign in to comment.