Skip to content

Commit

Permalink
add invalid response
Browse files Browse the repository at this point in the history
  • Loading branch information
ArrayIterator committed Nov 10, 2023
1 parent 2458f20 commit e7dccd6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Cache/CacheStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public function setAdapter(CacheAdapterInterface $cacheAdapter): void
*/
public function saveItem(PacketResponseInterface $response, int|DateInterval|null $ttl = self::DEFAULT_TTL): bool
{
$cacheItem = $this->getAdapter()->getItem($this->getCacheName($response->getPacketData()));
$cacheItem = $this->getAdapter()?->getItem($this->getCacheName($response->getPacketData()));
if ($cacheItem === null) {
return false;
}
$cacheItem
->set($response)
->expiresAfter($ttl??self::DEFAULT_TTL);
Expand Down

0 comments on commit e7dccd6

Please sign in to comment.