Updates to artist credit handling

This commit is contained in:
Connor Johnstone
2026-03-18 14:34:13 -04:00
parent 1fbafc25df
commit dae5fce12c
2 changed files with 27 additions and 0 deletions

View File

@@ -274,4 +274,22 @@ async fn test_search_cache_ttl() {
// Purge expired
let purged = queries::cache::purge_expired(conn).await.unwrap();
assert_eq!(purged, 1);
// Purge by prefix
queries::cache::set(conn, "artist_totals:1", "computed", "[10,5,3]", 3600)
.await
.unwrap();
queries::cache::set(conn, "artist_totals:2", "computed", "[20,10,5]", 3600)
.await
.unwrap();
queries::cache::set(conn, "other_key", "computed", "{}", 3600)
.await
.unwrap();
let purged = queries::cache::purge_prefix(conn, "artist_totals:").await.unwrap();
assert_eq!(purged, 2);
// other_key should still exist
let result = queries::cache::get(conn, "other_key").await.unwrap();
assert!(result.is_some());
}