Skip to content

Commit

Permalink
PHP 7.4 Support 馃帀 (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel committed Nov 28, 2019
1 parent 9282d1a commit d442271
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ php:
- '7.1'
- '7.2'
- '7.3'
- '7.4snapshot'

env:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -23,7 +23,7 @@
"require-dev": {
"ext-pcntl": "*",
"friendsofphp/php-cs-fixer": "^2.9",
"mockery/mockery": "^1.2.0",
"mockery/mockery": "^1.3.0",
"php-mock/php-mock": "^2.0",
"phpunit/phpunit": "7.5.17"
},
Expand Down
4 changes: 4 additions & 0 deletions src/Cache/RedisStore.php
Expand Up @@ -51,6 +51,10 @@ public function get(string $key, bool $withExpired = false)
return $contents;
}

if ( ! $contents) {
return null;
}

$isExpired = Carbon::parse($contents['expires_at'])->lt(Carbon::now());

return $isExpired ? null : $contents;
Expand Down
2 changes: 2 additions & 0 deletions tests/Cache/RedisStoreTest.php
Expand Up @@ -111,6 +111,8 @@ public function it_sets_and_gets_cache_contents()
{
$cacheContent = ['expires_at' => 'Sat, 09 Dec 2017 16:25:51 GMT', 'offset' => 100];

$this->assertNull(static::$redisStore->get('invalid key'));

static::$redisStore->setTtl(1);

$this->assertTrue(static::$redisStore->set($this->checksum, $cacheContent));
Expand Down

0 comments on commit d442271

Please sign in to comment.