album_cache
¶
Album cache service with TTL-aware entries and CSV persistence.
AlbumCacheService
¶
Specialized cache service for album release years with CSV persistence.
Initialize album cache service.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
AppConfig
|
Typed application configuration |
required |
logger
|
Logger | None
|
Optional logger instance |
None
|
Source code in src/services/cache/album_cache.py
initialize
async
¶
Initialize album cache by loading data from disk.
Source code in src/services/cache/album_cache.py
get_album_year
async
¶
Get album release year from cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name |
required |
album
|
str
|
Album name |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
Album release year if found, None otherwise |
Source code in src/services/cache/album_cache.py
get_album_year_entry
async
¶
Get full album cache entry (not just year).
Use this method when you need to check confidence level before trusting cached data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name |
required |
album
|
str
|
Album name |
required |
Returns:
| Type | Description |
|---|---|
AlbumCacheEntry | None
|
Full AlbumCacheEntry if found and not expired, None otherwise |
Source code in src/services/cache/album_cache.py
store_album_year
async
¶
Store album release year in cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name |
required |
album
|
str
|
Album name |
required |
year
|
str
|
Album release year |
required |
confidence
|
int
|
Confidence score 0-100 (higher = more trustworthy) |
0
|
Source code in src/services/cache/album_cache.py
invalidate_album
async
¶
Invalidate specific album from cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
artist
|
str
|
Artist name |
required |
album
|
str
|
Album name |
required |
Source code in src/services/cache/album_cache.py
invalidate_all
async
¶
Clear all album cache entries.
Source code in src/services/cache/album_cache.py
save_to_disk
async
¶
Save album cache to CSV file.
Source code in src/services/cache/album_cache.py
get_stats
¶
Get album cache statistics.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary containing cache statistics |