From 478b5ec15dde5f4d6453aff4147f07d5c0730a90 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Mon, 22 Jun 2026 09:06:00 +0200 Subject: [PATCH] refactor(integration) : drop unused bookstack shelf-id cache --- .../Service/BookStackApiService.php | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/src/Module/Integration/Infrastructure/Service/BookStackApiService.php b/src/Module/Integration/Infrastructure/Service/BookStackApiService.php index 5a5fa17..ec918da 100644 --- a/src/Module/Integration/Infrastructure/Service/BookStackApiService.php +++ b/src/Module/Integration/Infrastructure/Service/BookStackApiService.php @@ -15,9 +15,6 @@ use Throwable; final class BookStackApiService { - /** @var array */ - private array $shelfBookCache = []; - public function __construct( private readonly HttpClientInterface $httpClient, private readonly BookStackConfigurationRepositoryInterface $configRepository, @@ -81,9 +78,6 @@ final class BookStackApiService $bookSlugs[$book['id']] = $book['slug'] ?? ''; } - // Update cache for getShelfBookIds - $this->shelfBookCache[$shelfId] = $bookIds; - $config = $this->getConfiguration(); $baseUrl = rtrim($config->getUrl() ?? '', '/'); $trimmed = trim($query); @@ -141,24 +135,6 @@ final class BookStackApiService return $this->request('GET', sprintf('/api/books/%d', $id)); } - /** - * @return int[] - */ - private function getShelfBookIds(int $shelfId): array - { - if (isset($this->shelfBookCache[$shelfId])) { - return $this->shelfBookCache[$shelfId]; - } - - $data = $this->request('GET', sprintf('/api/shelves/%d', $shelfId)); - $books = $data['books'] ?? []; - - $ids = array_map(static fn (array $book): int => $book['id'], $books); - $this->shelfBookCache[$shelfId] = $ids; - - return $ids; - } - private function getConfiguration(): BookStackConfiguration { $config = $this->configRepository->findSingleton();