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