Properly use "saveDeferred" only in instances where "commit" is called later.

This commit is contained in:
Buster Neece 2023-05-22 21:54:23 -05:00
parent 5653dfae87
commit 68b7dee8a9
No known key found for this signature in database
7 changed files with 18 additions and 5 deletions

View File

@ -84,7 +84,7 @@ final class ListAction extends AbstractSearchableListAction
$item->set($playlistIds);
$item->expiresAfter(600);
$this->psr6Cache->saveDeferred($item);
$this->psr6Cache->save($item);
}
return $item->get();

View File

@ -130,7 +130,7 @@ final class ListAction extends AbstractSearchableListAction
$item->set($ids);
$item->expiresAfter(600);
$this->psr6Cache->saveDeferred($item);
$this->psr6Cache->save($item);
}
return $item->get();

View File

@ -96,7 +96,7 @@ final class ScheduleAction
);
$cacheItem->expiresAfter(600);
$this->psr6Cache->saveDeferred($cacheItem);
$this->psr6Cache->save($cacheItem);
}
$events = $cacheItem->get();
@ -117,7 +117,7 @@ final class ScheduleAction
$cacheItem->set($this->scheduleRepo->getUpcomingSchedule($station, $now));
$cacheItem->expiresAfter(60);
$this->psr6Cache->saveDeferred($cacheItem);
$this->psr6Cache->save($cacheItem);
}
$events = $cacheItem->get();

View File

@ -210,6 +210,9 @@ final class ListenerRepository extends Repository
} finally {
@unlink($tempCsvPath);
}
$this->deviceDetector->saveCache();
$this->ipGeolocation->saveCache();
}
private function batchAddRow(Entity\Station $station, Client $client): array

View File

@ -52,4 +52,9 @@ final class DeviceDetector
return $deviceResult;
}
public function saveCache(): bool
{
return $this->psr6Cache->commit();
}
}

View File

@ -77,7 +77,7 @@ final class OAuthAdapter implements RefreshableTokenProvider
}
$cacheItem->expiresAfter(600);
$this->psr6Cache->saveDeferred($cacheItem);
$this->psr6Cache->save($cacheItem);
}
return $cacheItem->get();

View File

@ -114,4 +114,9 @@ final class IpGeolocation
];
}
}
public function saveCache(): bool
{
return $this->psr6Cache->commit();
}
}