add 12 hour cache for list count queries

This commit is contained in:
jeffvli
2025-11-29 17:54:57 -08:00
parent 8611bb9755
commit 3f704f1f35
5 changed files with 12 additions and 0 deletions
@@ -36,6 +36,7 @@ export const albumQueries = {
},
listCount: (args: QueryHookArgs<ListCountQuery<AlbumListQuery>>) => {
return queryOptions({
gcTime: 1000 * 60 * 60 * 12,
queryFn: ({ signal }) => {
return api.controller.getAlbumListCount({
apiClientProps: { serverId: args.serverId, signal },
@@ -47,6 +48,7 @@ export const albumQueries = {
args.query,
args.query?.artistIds?.length === 1 ? args.query?.artistIds[0] : undefined,
),
staleTime: 1000 * 60 * 60 * 12,
...args.options,
});
},
@@ -38,6 +38,7 @@ export const artistsQueries = {
},
albumArtistListCount: (args: QueryHookArgs<ListCountQuery<AlbumArtistListQuery>>) => {
return queryOptions({
gcTime: 1000 * 60 * 60 * 12,
queryFn: ({ signal }) => {
return api.controller.getAlbumArtistListCount({
apiClientProps: { serverId: args.serverId, signal },
@@ -48,6 +49,7 @@ export const artistsQueries = {
args.serverId,
Object.keys(args.query).length === 0 ? undefined : args.query,
),
staleTime: 1000 * 60 * 60 * 12,
...args.options,
});
},
@@ -65,6 +67,7 @@ export const artistsQueries = {
},
artistListCount: (args: QueryHookArgs<ListCountQuery<ArtistListQuery>>) => {
return queryOptions({
gcTime: 1000 * 60 * 60 * 12,
queryFn: ({ signal }) => {
return api.controller
.getArtistList({
@@ -77,6 +80,7 @@ export const artistsQueries = {
args.serverId,
Object.keys(args.query).length === 0 ? undefined : args.query,
),
staleTime: 1000 * 60 * 60 * 12,
...args.options,
});
},
@@ -27,6 +27,7 @@ export const genresQueries = {
},
listCount: (args: QueryHookArgs<ListCountQuery<GenreListQuery>>) => {
return queryOptions({
gcTime: 1000 * 60 * 60 * 12,
queryFn: ({ signal }) => {
return api.controller
.getGenreList({
@@ -39,6 +40,7 @@ export const genresQueries = {
args.serverId,
Object.keys(args.query).length === 0 ? undefined : args.query,
),
staleTime: 1000 * 60 * 60 * 12,
...args.options,
});
},
@@ -38,6 +38,7 @@ export const playlistsQueries = {
},
listCount: (args: QueryHookArgs<ListCountQuery<PlaylistListQuery>>) => {
return queryOptions({
gcTime: 1000 * 60 * 60 * 12,
queryFn: ({ signal }) => {
return api.controller.getPlaylistListCount({
apiClientProps: { serverId: args.serverId, signal },
@@ -48,6 +49,7 @@ export const playlistsQueries = {
args.serverId || '',
Object.keys(args.query).length === 0 ? undefined : args.query,
),
staleTime: 1000 * 60 * 60 * 12,
...args.options,
});
},
@@ -21,6 +21,7 @@ export const songsQueries = {
},
listCount: (args: QueryHookArgs<ListCountQuery<SongListQuery>>) => {
return queryOptions({
gcTime: 1000 * 60 * 60 * 12,
queryFn: ({ signal }) => {
return api.controller.getSongListCount({
apiClientProps: { serverId: args.serverId, signal },
@@ -31,6 +32,7 @@ export const songsQueries = {
args.serverId,
Object.keys(args.query).length === 0 ? undefined : args.query,
),
staleTime: 1000 * 60 * 60 * 12,
...args.options,
});
},