| @@ 63-78 (lines=16) @@ | ||
| 60 | * @param array $data |
|
| 61 | * @return $this |
|
| 62 | */ |
|
| 63 | public function store($key, $timeout, array $data = []) { |
|
| 64 | $key = trim(strtolower($key)); |
|
| 65 | if(!in_array($key, $this->services)) { |
|
| 66 | $this->services[] = $key; |
|
| 67 | } else { |
|
| 68 | throw new RuntimeException("Duplicate service: {$key}"); |
|
| 69 | } |
|
| 70 | ||
| 71 | if($this->has($key)) { |
|
| 72 | $this->updateService->execute(['key' => $key, 'timeout' => $timeout]); |
|
| 73 | } else { |
|
| 74 | $this->insertService->execute(['key' => $key, 'timeout' => $timeout, 'try' => '2000-01-01 00:00:00', 'run' => '2000-01-01 00:00:00']); |
|
| 75 | } |
|
| 76 | ||
| 77 | return $this; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * @param callable $fn |
|
| @@ 66-81 (lines=16) @@ | ||
| 63 | * @param array $data |
|
| 64 | * @return $this |
|
| 65 | */ |
|
| 66 | public function store($key, $timeout, array $data = []) { |
|
| 67 | $key = trim(strtolower($key)); |
|
| 68 | if(!in_array($key, $this->services)) { |
|
| 69 | $this->services[] = $key; |
|
| 70 | } else { |
|
| 71 | throw new RuntimeException("Duplicate service: {$key}"); |
|
| 72 | } |
|
| 73 | ||
| 74 | if($this->has($key)) { |
|
| 75 | $this->updateService->execute(['key' => $key, 'timeout' => $timeout]); |
|
| 76 | } else { |
|
| 77 | $this->insertService->execute(['key' => $key, 'timeout' => $timeout, 'try' => '2000-01-01 00:00:00', 'run' => '2000-01-01 00:00:00']); |
|
| 78 | } |
|
| 79 | ||
| 80 | return $this; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * @param callable $fn |
|