Skip to content

Commit

Permalink
Merge pull request #51 from nick322/patch-1
Browse files Browse the repository at this point in the history
(#50) Backward compatibility Laravel Cache
  • Loading branch information
Gman98ish authored Apr 9, 2021
2 parents d3969e9 + ddbd4ef commit 087a73e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"ext-json": "*",
"illuminate/support": "^5.4|^6.0|^7.0|^8.0",
"illuminate/http": "^5.4|^6.0|^7.0|^8.0",
"illuminate/console": "^5.4|^6.0|^7.0|^8.0"
"illuminate/console": "^5.4|^6.0|^7.0|^8.0",
"nesbot/carbon": "^1.26.3|^2.0"
},
"require-dev": {
"phpunit/phpunit": ">=5.0",
Expand Down
3 changes: 2 additions & 1 deletion src/Checks/CacheHealthCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\Cache;
use UKFast\HealthCheck\HealthCheck;
use Carbon\Carbon;

class CacheHealthCheck extends HealthCheck
{
Expand All @@ -21,7 +22,7 @@ public function status()
try {
$cache = Cache::store($store);

$cache->put('laravel-health-check', 'healthy', 60);
$cache->put('laravel-health-check', 'healthy', Carbon::now()->addMinutes(1));

$value = $cache->pull('laravel-health-check', 'broken');

Expand Down
4 changes: 2 additions & 2 deletions src/Commands/CacheSchedulerRunning.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use UKFast\HealthCheck\Checks\SchedulerHealthCheck;

use Carbon\Carbon;
class CacheSchedulerRunning extends Command
{
/**
Expand All @@ -23,6 +23,6 @@ public function handle()
$cacheKey = config('healthcheck.scheduler.cache-key');
$cacheMinutes = config('healthcheck.scheduler.minutes-between-checks');

Cache::put($cacheKey, 'healthy', (60 * $cacheMinutes));
Cache::put($cacheKey, 'healthy', Carbon::now()->addMinutes($cacheMinutes));
}
}

0 comments on commit 087a73e

Please sign in to comment.