Skip to content

Commit

Permalink
Update caching to work with laravel 5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jradtilbrook committed Mar 9, 2019
1 parent 1013454 commit 9c91656
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"require": {
"aws/aws-sdk-php": "~3.0",
"aws/aws-sdk-php-laravel": "~3.0",
"illuminate/cache": "~5.6.0 || ~5.7.0",
"illuminate/contracts": "~5.6.0 || ~5.7.0",
"illuminate/support": "~5.6.0 || ~5.7.0"
"illuminate/cache": ">=5.6",
"illuminate/contracts": ">=5.6",
"illuminate/support": ">=5.6"
},
"require-dev": {
"orchestra/testbench": "^3.6",
Expand Down
7 changes: 6 additions & 1 deletion src/Cache/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ public function get($key)
public function set($key, $value, $ttl = 0)
{
// NOTE: laravel uses minutes (pre 5.8) so this conversion is required
$this->cache->put($this->makeKey($key), $value, ceil($ttl / 60));
$version = (float)app()->version();
if ($version <= 5.8) {
$ttl = ceil($ttl / 60);
}

$this->cache->put($this->makeKey($key), $value, $ttl);
}

/**
Expand Down

0 comments on commit 9c91656

Please sign in to comment.