@@ 44-53 (lines=10) @@ | ||
41 | return $this->getTaskRepository()->getAll($userId); |
|
42 | } |
|
43 | ||
44 | public function getOne(int $taskId, int $userId) |
|
45 | { |
|
46 | if (self::isRedisEnabled() === true) { |
|
47 | $task = $this->getTaskFromCache($taskId, $userId); |
|
48 | } else { |
|
49 | $task = $this->getTaskFromDb($taskId, $userId); |
|
50 | } |
|
51 | ||
52 | return $task; |
|
53 | } |
|
54 | ||
55 | public function getTaskFromCache(int $taskId, int $userId) |
|
56 | { |
|
@@ 142-151 (lines=10) @@ | ||
139 | return $tasks; |
|
140 | } |
|
141 | ||
142 | public function delete(int $taskId, int $userId): string |
|
143 | { |
|
144 | $this->getTaskFromDb($taskId, $userId); |
|
145 | $data = $this->getTaskRepository()->delete($taskId, $userId); |
|
146 | if (self::isRedisEnabled() === true) { |
|
147 | $this->deleteFromCache($taskId, $userId); |
|
148 | } |
|
149 | ||
150 | return $data; |
|
151 | } |
|
152 | } |
|
153 |