Skip to content

Commit

Permalink
v5.x: Fixed expiration to be in seconds. (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
spont4e authored Mar 14, 2024
1 parent ba3dc19 commit f47abff
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 161 deletions.
39 changes: 0 additions & 39 deletions .github/workflows/run-tests-l5.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/run-tests-l6.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/run-tests-l7.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/run-tests-l8.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/run-tests-l9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "Run Tests - Laravel 9"

on:
push:
branches: [ v5.x, master ]
branches: [ v5.x ]

pull_request:
branches: [ v5.x, master ]
branches: [ v5.x ]

jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "1ff/laravel-mongodb-cache",
"description": "A mongodb cache driver for laravel",
"type": "library",
"version": "5.0.0",
"version": "5.0.1",
"require": {
"jenssegers/mongodb": "~3.9",
"illuminate/cache": "^9.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function getExpiration($key)

$expirationSeconds = $cacheData['expiration']->toDateTime()->getTimestamp();

return round(($expirationSeconds - $this->currentTime()) / 60);
return round($expirationSeconds - $this->currentTime());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/StoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
}

0 comments on commit f47abff

Please sign in to comment.