Skip to content

Commit

Permalink
Fix cache key error
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Jan 2, 2023
1 parent 8b2e78d commit 5d32327
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
packagist:
build:
context: .
image: okvpn/packeton:latest
image: packeton/packeton:latest
container_name: packagist
hostname: packagist
environment:
Expand Down
8 changes: 4 additions & 4 deletions src/Repository/PackageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -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();
Expand All @@ -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'];
Expand All @@ -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();

Expand Down

0 comments on commit 5d32327

Please sign in to comment.