hash_service
¶
Unified Hash Service for Cache Operations.
This module provides a centralized hash service that unifies all hash operations across the cache system using SHA256 as the standard algorithm.
Replaces: - UnifiedKeyGenerator.album_key() (MD5) → hash_album_key() (SHA256) - UnifiedKeyGenerator.hash_key() (SHA256) → hash_generic_key() (SHA256) - OptimizedHashGenerator.generate_key() (SHA256) → hash_api_key() (SHA256)
UnifiedHashService
¶
Unified service for all cache hash operations using SHA256.
hash_album_key
classmethod
¶
Generate SHA256 hash for album cache key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name |
required |
album
|
str
|
Album name |
required |
Returns:
| Type | Description |
|---|---|
str
|
SHA256 hash string |
Source code in src/services/cache/hash_service.py
hash_api_key
classmethod
¶
Generate SHA256 hash for API cache key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name |
required |
album
|
str
|
Album name |
required |
source
|
str
|
API source identifier |
required |
Returns:
| Type | Description |
|---|---|
str
|
SHA256 hash string |
Source code in src/services/cache/hash_service.py
hash_generic_key
classmethod
¶
Generate SHA256 hash for generic cache key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Any data that can be converted to string |
required |
Returns:
| Type | Description |
|---|---|
str
|
SHA256 hash string |
Note
Non-JSON-serializable dict values are converted to their string representation.
Source code in src/services/cache/hash_service.py
hash_pending_key
classmethod
¶
Generate SHA256 hash for pending verification key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
track_id
|
str
|
Track identifier for pending verification |
required |
Returns:
| Type | Description |
|---|---|
str
|
SHA256 hash string |