mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-16 15:19:34 +00:00
Use xxh3 for generating hash keys instead of md5 as it offers better performance
This commit is contained in:
parent
2f580c92d1
commit
641c8388c1
3 changed files with 5 additions and 5 deletions
|
|
@ -104,7 +104,7 @@ final class FieldHelper
|
||||||
{
|
{
|
||||||
$db_platform = $qb->getEntityManager()->getConnection()->getDatabasePlatform();
|
$db_platform = $qb->getEntityManager()->getConnection()->getDatabasePlatform();
|
||||||
|
|
||||||
$key = 'field2_' . md5($field_expr);
|
$key = 'field2_' . hash('xxh3', $field_expr);
|
||||||
|
|
||||||
//If we are on MySQL, we can just use the FIELD function
|
//If we are on MySQL, we can just use the FIELD function
|
||||||
if ($db_platform instanceof AbstractMySQLPlatform) {
|
if ($db_platform instanceof AbstractMySQLPlatform) {
|
||||||
|
|
@ -121,4 +121,4 @@ final class FieldHelper
|
||||||
|
|
||||||
return $qb;
|
return $qb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ class FileTypeFilterTools
|
||||||
{
|
{
|
||||||
$filter = trim($filter);
|
$filter = trim($filter);
|
||||||
|
|
||||||
return $this->cache->get('filter_exts_'.md5($filter), function (ItemInterface $item) use ($filter) {
|
return $this->cache->get('filter_exts_'.hash('xxh3', $filter), function (ItemInterface $item) use ($filter) {
|
||||||
$elements = explode(',', $filter);
|
$elements = explode(',', $filter);
|
||||||
$extensions = [];
|
$extensions = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -397,13 +397,13 @@ class OEMSecretsProvider implements InfoProviderInterface
|
||||||
* Generates a cache key for storing part details based on the provided provider ID.
|
* Generates a cache key for storing part details based on the provided provider ID.
|
||||||
*
|
*
|
||||||
* This method creates a unique cache key by prefixing the provider ID with 'part_details_'
|
* This method creates a unique cache key by prefixing the provider ID with 'part_details_'
|
||||||
* and hashing the provider ID using MD5 to ensure a consistent and compact key format.
|
* and hashing the provider ID using XXH3 to ensure a consistent and compact key format.
|
||||||
*
|
*
|
||||||
* @param string $provider_id The unique identifier of the provider or part.
|
* @param string $provider_id The unique identifier of the provider or part.
|
||||||
* @return string The generated cache key.
|
* @return string The generated cache key.
|
||||||
*/
|
*/
|
||||||
private function getCacheKey(string $provider_id): string {
|
private function getCacheKey(string $provider_id): string {
|
||||||
return 'oemsecrets_part_' . md5($provider_id);
|
return 'oemsecrets_part_' . hash('xxh3', $provider_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue