Skip to content

Commit

Permalink
Merge branch 'release/1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Culka committed Nov 4, 2024
2 parents 3435240 + 731d68b commit 6115e7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
15 changes: 10 additions & 5 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6115e7a

Please sign in to comment.