Skip to content

Commit

Permalink
v2.12.x: Fixed expiration to be in seconds. (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
spont4e authored Mar 13, 2024
1 parent 8f05706 commit a7b7314
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests-l5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "Run Tests - Laravel 5"

on:
push:
branches: [ v2.12, master ]
branches: [ v2.12 ]

pull_request:
branches: [ v2.12, master ]
branches: [ v2.12 ]

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

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"name": "1ff/laravel-mongodb-cache",
"description": "A mongodb cache driver for laravel",
"type": "library",
"version": "3.0.0",
"version": "2.12.5",
"require": {
"jenssegers/mongodb": "~3.7",
"illuminate/cache": "^7.0"
"jenssegers/mongodb": "^3.5|^3.6",
"illuminate/cache": "^5.8|^6"
},
"require-dev": {
"orchestra/testbench": "^5.0"
"orchestra/testbench": "^3.0|^4.0"
},
"license": "MIT",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion src/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getExpiration($key)

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

return round(($expirationSeconds - time()) / 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 a7b7314

Please sign in to comment.