src/Shutdown/PredisShutdown.php 1 location
|
@@ 64-74 (lines=11) @@
|
| 61 |
|
* |
| 62 |
|
* Sets to Redis value `$shutdownTime` (or current DateTime) to `$key` defined in constructor. |
| 63 |
|
*/ |
| 64 |
|
public function shutdown(DateTime $shutdownTime = null): bool |
| 65 |
|
{ |
| 66 |
|
if ($shutdownTime === null) { |
| 67 |
|
$shutdownTime = new DateTime(); |
| 68 |
|
} |
| 69 |
|
|
| 70 |
|
/** @var \Predis\Response\Status $response */ |
| 71 |
|
$response = $this->redis->set($this->key, $shutdownTime->format('U')); |
| 72 |
|
|
| 73 |
|
return $response->getPayload() === 'OK'; |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
|
|
src/Shutdown/RedisShutdown.php 1 location
|
@@ 63-70 (lines=8) @@
|
| 60 |
|
* |
| 61 |
|
* Sets to Redis value `$shutdownTime` (or current DateTime) to `$key` defined in constructor. |
| 62 |
|
*/ |
| 63 |
|
public function shutdown(DateTime $shutdownTime = null): bool |
| 64 |
|
{ |
| 65 |
|
if ($shutdownTime === null) { |
| 66 |
|
$shutdownTime = new DateTime(); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
return $this->redis->set($this->key, $shutdownTime->format('U')); |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
|
|
src/Shutdown/SharedFileShutdown.php 1 location
|
@@ 39-46 (lines=8) @@
|
| 36 |
|
* |
| 37 |
|
* Creates file defined in constructor with modification time `$shutdownTime` (or current DateTime). |
| 38 |
|
*/ |
| 39 |
|
public function shutdown(DateTime $shutdownTime = null): bool |
| 40 |
|
{ |
| 41 |
|
if ($shutdownTime === null) { |
| 42 |
|
$shutdownTime = new DateTime(); |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
return touch($this->filePath, (int) $shutdownTime->format('U')); |
| 46 |
|
} |
| 47 |
|
} |
| 48 |
|
|