From 5d32327ce764b2098d24ee6d4347f48434ec19b4 Mon Sep 17 00:00:00 2001 From: Uladzimir Tsykun Date: Mon, 2 Jan 2023 02:37:32 +0100 Subject: [PATCH] Fix cache key error --- docker-compose.yml | 2 +- src/Repository/PackageRepository.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ef567367..f517f6b4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: packagist: build: context: . - image: okvpn/packeton:latest + image: packeton/packeton:latest container_name: packagist hostname: packagist environment: diff --git a/src/Repository/PackageRepository.php b/src/Repository/PackageRepository.php index cf018a86..b3fadefa 100644 --- a/src/Repository/PackageRepository.php +++ b/src/Repository/PackageRepository.php @@ -302,7 +302,7 @@ public function getDependentCount($name) ) x'; $stmt = $this->getEntityManager()->getConnection() - ->executeCacheQuery($sql, ['name' => $name], [], new QueryCacheProfile(7*86400, 'dependents_count_'.$name, $this->getEntityManager()->getConfiguration()->getResultCacheImpl())); + ->executeQuery($sql, ['name' => $name], [], new QueryCacheProfile(86400, sha1('dependents_count_'.$name), $this->getEntityManager()->getConfiguration()->getResultCacheImpl())); $result = $stmt->fetchAllAssociative(); return (int) $result[0]['count']; @@ -322,7 +322,7 @@ public function getDependents($name, $offset = 0, $limit = 15) $sql, ['name' => $name], [], - new QueryCacheProfile(7*86400, 'dependents_'.$name.'_'.$offset.'_'.$limit, $this->getEntityManager()->getConfiguration()->getResultCacheImpl()) + new QueryCacheProfile(86400, sha1('dependents_'.$name.$offset.'_'.$limit), $this->getEntityManager()->getConfiguration()->getResultCacheImpl()) ); return $stmt->fetchAllAssociative(); @@ -336,7 +336,7 @@ public function getSuggestCount($name) WHERE s.packageName = :name'; $stmt = $this->getEntityManager()->getConnection() - ->executeCacheQuery($sql, ['name' => $name], [], new QueryCacheProfile(7*86400, 'suggesters_count_'.$name, $this->getEntityManager()->getConfiguration()->getResultCacheImpl())); + ->executeCacheQuery($sql, ['name' => $name], [], new QueryCacheProfile(86400, sha1('suggesters_count_'.$name), $this->getEntityManager()->getConfiguration()->getResultCacheImpl())); $result = $stmt->fetchAllAssociative(); return (int) $result[0]['count']; @@ -357,7 +357,7 @@ public function getSuggests($name, $offset = 0, $limit = 15) $sql, ['name' => $name], [], - new QueryCacheProfile(7*86400, 'suggesters_'.$name.'_'.$offset.'_'.$limit, $this->getEntityManager()->getConfiguration()->getResultCacheImpl()) + new QueryCacheProfile(86400, sha1('suggesters_'.$name.$offset.'_'.$limit), $this->getEntityManager()->getConfiguration()->getResultCacheImpl()) ); $result = $stmt->fetchAllAssociative();