From 214789328078f8a03ed9b3405bb858a46ec10518 Mon Sep 17 00:00:00 2001 From: IdentiqTrexima Date: Mon, 4 Nov 2024 08:24:29 +0100 Subject: [PATCH 1/2] feat: added uncached search isco call in case of argument encoding failure (#7) --- src/Client.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Client.php b/src/Client.php index 1763411..94990c9 100644 --- a/src/Client.php +++ b/src/Client.php @@ -179,12 +179,17 @@ public function searchIsco(?string $title = null, ?int $workArea = null, ?string if ($perPage === 0) { $args['pagination'] = false; } - $cacheKey = 'search-isco-' . crc32(json_encode($args)); - $result = $this->cache->get($cacheKey, function (ItemInterface $item) use ($args) { - $item->expiresAfter($this->cacheTtl); + if ($json = json_encode($args)) { + $cacheKey = 'search-isco-' . crc32($json); + $result = $this->cache->get($cacheKey, function (ItemInterface $item) use ($args) { + $item->expiresAfter($this->cacheTtl); + $resource = $this->get('api/isco', $args); + return (string)$resource->getBody(); + }); + } else { $resource = $this->get('api/isco', $args); - return (string)$resource->getBody(); - }); + $result = (string)$resource->getBody(); + } return $this->jsonDecode($result); } From 731d68bfd6006080bebe6e5e37c40deab90777cf Mon Sep 17 00:00:00 2001 From: Peter Culka Date: Mon, 4 Nov 2024 08:26:11 +0100 Subject: [PATCH 2/2] RELEASE 1.3.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9810e45..4d05c7d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "trexima/harvey-client", "description": "Client for Harvey API v2", - "version": "1.3.1", + "version": "1.3.2", "type": "library", "license": "MIT", "authors": [