mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Reenable caching for part provider system.
This commit is contained in:
parent
5750e7dbdf
commit
d847b74522
1 changed files with 2 additions and 8 deletions
|
@ -74,10 +74,7 @@ final class PartInfoRetriever
|
||||||
protected function searchInProvider(InfoProviderInterface $provider, string $keyword): array
|
protected function searchInProvider(InfoProviderInterface $provider, string $keyword): array
|
||||||
{
|
{
|
||||||
//Generate key and escape reserved characters from the provider id
|
//Generate key and escape reserved characters from the provider id
|
||||||
$escaped_keyword = urlencode($keyword) . uniqid();
|
$escaped_keyword = urlencode($keyword);
|
||||||
|
|
||||||
dump("Remove the uniqid() from the escaped_part_id variable to use the cache");
|
|
||||||
|
|
||||||
return $this->partInfoCache->get("search_{$provider->getProviderKey()}_{$escaped_keyword}", function (ItemInterface $item) use ($provider, $keyword) {
|
return $this->partInfoCache->get("search_{$provider->getProviderKey()}_{$escaped_keyword}", function (ItemInterface $item) use ($provider, $keyword) {
|
||||||
//Set the expiration time
|
//Set the expiration time
|
||||||
$item->expiresAfter(self::CACHE_RESULT_EXPIRATION);
|
$item->expiresAfter(self::CACHE_RESULT_EXPIRATION);
|
||||||
|
@ -98,10 +95,7 @@ final class PartInfoRetriever
|
||||||
$provider = $this->provider_registry->getProviderByKey($provider_key);
|
$provider = $this->provider_registry->getProviderByKey($provider_key);
|
||||||
|
|
||||||
//Generate key and escape reserved characters from the provider id
|
//Generate key and escape reserved characters from the provider id
|
||||||
$escaped_part_id = urlencode($part_id) .uniqid();
|
$escaped_part_id = urlencode($part_id);
|
||||||
|
|
||||||
dump("Remove the uniqid() from the escaped_part_id variable to use the cache");
|
|
||||||
|
|
||||||
return $this->partInfoCache->get("details_{$provider_key}_{$escaped_part_id}", function (ItemInterface $item) use ($provider, $part_id) {
|
return $this->partInfoCache->get("details_{$provider_key}_{$escaped_part_id}", function (ItemInterface $item) use ($provider, $part_id) {
|
||||||
//Set the expiration time
|
//Set the expiration time
|
||||||
$item->expiresAfter(self::CACHE_DETAIL_EXPIRATION);
|
$item->expiresAfter(self::CACHE_DETAIL_EXPIRATION);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue