From 0f000617e781e4ca260c68578023b6c65598d606 Mon Sep 17 00:00:00 2001 From: Ivaylo Mutafov Date: Wed, 13 Mar 2024 18:28:18 +0200 Subject: [PATCH] v6.x: Fixed expiration to be in seconds. --- composer.json | 4 ++-- src/Store.php | 2 +- tests/StoreTest.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c69e2bb..fd50f7f 100644 --- a/composer.json +++ b/composer.json @@ -2,11 +2,11 @@ "name": "1ff/laravel-mongodb-cache", "description": "A mongodb cache driver for laravel", "type": "library", - "version": "6.0.1", + "version": "6.0.2", "require": { "php": "^8.1", "illuminate/cache": "^10.0", - "mongodb/laravel-mongodb": "4.0.0-ALPHA2" + "mongodb/laravel-mongodb": "^4.1" }, "require-dev": { "orchestra/testbench": "^8.0" diff --git a/src/Store.php b/src/Store.php index 6d1e058..5d758f3 100644 --- a/src/Store.php +++ b/src/Store.php @@ -180,7 +180,7 @@ public function getExpiration($key) $expirationSeconds = $cacheData['expiration']->toDateTime()->getTimestamp(); - return round(($expirationSeconds - $this->currentTime()) / 60); + return round($expirationSeconds - $this->currentTime()); } /** diff --git a/tests/StoreTest.php b/tests/StoreTest.php index dd40071..502f9d2 100644 --- a/tests/StoreTest.php +++ b/tests/StoreTest.php @@ -140,6 +140,6 @@ public function it_retrieves_an_items_expiration_time_by_given_key() $sut = $this->store->getExpiration('test-key'); // Assert - $this->assertEquals(2880.0, $sut); // 2 days in seconds. + $this->assertEquals(172800, $sut); // 2 days in seconds. } }