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#

log

Functions#

is_valid(db_path)

Return True if the cached collection is up to date with db_path.

load()

Load tracks from the cache. Returns None if missing or corrupt.

load_if_valid(db_path)

Return cached tracks if the cache is valid for db_path, else None.

save(tracks, db_path)

Persist tracks and the current mtime of db_path to disk.

invalidate()

Delete the cache files (called when the user explicitly forces a reload).

Module Contents#

rekordbox_set_list_manager.services.collection_cache.log[source]#
rekordbox_set_list_manager.services.collection_cache.is_valid(db_path)[source]#

Return True if 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:

True if 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 None if missing or corrupt.

Returns:

The cached tracks, or None if 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 None if 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

rekordbox_set_list_manager.services.collection_cache.invalidate()[source]#

Delete the cache files (called when the user explicitly forces a reload).

Return type:

None