rekordbox_set_list_manager.services.collection_cache#
On-disk cache for the Rekordbox collection to avoid slow re-loads.
The cache stores all tracks as a JSON byte-stream in the platformdirs user-cache directory. Validity is checked against the modification time of the Rekordbox master.db file so the cache is automatically invalidated whenever Rekordbox writes a new library snapshot.
Attributes#
Functions#
|
Return |
|
Load tracks from the cache. Returns |
|
Return cached tracks if the cache is valid for db_path, else |
|
Persist tracks and the current mtime of db_path to disk. |
Delete the cache files (called when the user explicitly forces a reload). |
Module Contents#
- rekordbox_set_list_manager.services.collection_cache.is_valid(db_path)[source]#
Return
Trueif the cached collection is up to date with db_path.- Parameters:
db_path (Path) – Path to the Rekordbox SQLite database whose mtime is checked.
- Returns:
Trueif the cache exists and its recorded mtime matches db_path.- Return type:
bool
- rekordbox_set_list_manager.services.collection_cache.load()[source]#
Load tracks from the cache. Returns
Noneif missing or corrupt.- Returns:
The cached tracks, or
Noneif the cache file is absent or invalid.- Return type:
list[Track] | None
- rekordbox_set_list_manager.services.collection_cache.load_if_valid(db_path)[source]#
Return cached tracks if the cache is valid for db_path, else
None.- Parameters:
db_path (Path) – Path to the Rekordbox SQLite database to validate the cache against.
- Returns:
The cached track list if valid, or
Noneif the cache is stale or absent.- Return type:
list[Track] | None
- rekordbox_set_list_manager.services.collection_cache.save(tracks, db_path)[source]#
Persist tracks and the current mtime of db_path to disk.
- Parameters:
tracks (list[Track]) – The collection tracks to serialise and cache.
db_path (Path) – Path to the Rekordbox database; its mtime is stored for cache validation.
- Return type:
None