@@ 129-142 (lines=14) @@ | ||
126 | * @api |
|
127 | * @return \Forecast\Current|null Объект с текущей погодой |
|
128 | */ |
|
129 | public function getCurrent(Point $point): Current |
|
130 | { |
|
131 | $item = $this->cache->getItem($this->getCacheKeyCurrent($point)); |
|
132 | if (!$item->isHit()) { |
|
133 | $current = $this->doFetchCurrent($point); |
|
134 | $item |
|
135 | ->set($current) |
|
136 | ->expiresAt($this->getCacheExpirationCurrent()) |
|
137 | ->setTags(['weather']); |
|
138 | ||
139 | $this->cache->save($item); |
|
140 | } |
|
141 | return $item->get(); |
|
142 | } |
|
143 | ||
144 | /** |
|
145 | * @api |
|
@@ 151-162 (lines=12) @@ | ||
148 | * @param bool $forse |
|
149 | * @return Hourly |
|
150 | */ |
|
151 | public function getHourly(Point $point, bool $forse = false): Hourly |
|
152 | { |
|
153 | $item = $this->cache->getItem($this->getCacheKeyHourly($point)); |
|
154 | if ($forse || !$item->isHit()) { |
|
155 | $item |
|
156 | ->set($this->doFetchHourly($point)) |
|
157 | ->expiresAt($this->getCacheExpirationHourly()) |
|
158 | ->setTags(['weather']); |
|
159 | $this->cache->save($item); |
|
160 | } |
|
161 | return $item->get(); |
|
162 | } |
|
163 | ||
164 | /** |
|
165 | * |