Skip to content

Commit

Permalink
Document tuple return type of generateCacheKeys()
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Dec 18, 2022
1 parent b50fbfe commit 9c02717
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/Cache/QueryCacheProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function getCacheKey()
* @param array<int, Type|int|string|null>|array<string, Type|int|string|null> $types
* @param array<string, mixed> $connectionParams
*
* @return string[]
* @return array{string, string}
*/
public function generateCacheKeys($sql, $params, $types, array $connectionParams = [])
{
Expand All @@ -127,11 +127,7 @@ public function generateCacheKeys($sql, $params, $types, array $connectionParams
'&connectionParams=' . hash('sha256', serialize($connectionParams));

// should the key be automatically generated using the inputs or is the cache key set?
if ($this->cacheKey === null) {
$cacheKey = sha1($realCacheKey);
} else {
$cacheKey = $this->cacheKey;
}
$cacheKey = $this->cacheKey ?? sha1($realCacheKey);

return [$cacheKey, $realCacheKey];
}
Expand Down

0 comments on commit 9c02717

Please sign in to comment.