mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 21:50:35 +02:00
add 12 hour cache for list count queries
This commit is contained in:
@@ -36,6 +36,7 @@ export const albumQueries = {
|
|||||||
},
|
},
|
||||||
listCount: (args: QueryHookArgs<ListCountQuery<AlbumListQuery>>) => {
|
listCount: (args: QueryHookArgs<ListCountQuery<AlbumListQuery>>) => {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
|
gcTime: 1000 * 60 * 60 * 12,
|
||||||
queryFn: ({ signal }) => {
|
queryFn: ({ signal }) => {
|
||||||
return api.controller.getAlbumListCount({
|
return api.controller.getAlbumListCount({
|
||||||
apiClientProps: { serverId: args.serverId, signal },
|
apiClientProps: { serverId: args.serverId, signal },
|
||||||
@@ -47,6 +48,7 @@ export const albumQueries = {
|
|||||||
args.query,
|
args.query,
|
||||||
args.query?.artistIds?.length === 1 ? args.query?.artistIds[0] : undefined,
|
args.query?.artistIds?.length === 1 ? args.query?.artistIds[0] : undefined,
|
||||||
),
|
),
|
||||||
|
staleTime: 1000 * 60 * 60 * 12,
|
||||||
...args.options,
|
...args.options,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export const artistsQueries = {
|
|||||||
},
|
},
|
||||||
albumArtistListCount: (args: QueryHookArgs<ListCountQuery<AlbumArtistListQuery>>) => {
|
albumArtistListCount: (args: QueryHookArgs<ListCountQuery<AlbumArtistListQuery>>) => {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
|
gcTime: 1000 * 60 * 60 * 12,
|
||||||
queryFn: ({ signal }) => {
|
queryFn: ({ signal }) => {
|
||||||
return api.controller.getAlbumArtistListCount({
|
return api.controller.getAlbumArtistListCount({
|
||||||
apiClientProps: { serverId: args.serverId, signal },
|
apiClientProps: { serverId: args.serverId, signal },
|
||||||
@@ -48,6 +49,7 @@ export const artistsQueries = {
|
|||||||
args.serverId,
|
args.serverId,
|
||||||
Object.keys(args.query).length === 0 ? undefined : args.query,
|
Object.keys(args.query).length === 0 ? undefined : args.query,
|
||||||
),
|
),
|
||||||
|
staleTime: 1000 * 60 * 60 * 12,
|
||||||
...args.options,
|
...args.options,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -65,6 +67,7 @@ export const artistsQueries = {
|
|||||||
},
|
},
|
||||||
artistListCount: (args: QueryHookArgs<ListCountQuery<ArtistListQuery>>) => {
|
artistListCount: (args: QueryHookArgs<ListCountQuery<ArtistListQuery>>) => {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
|
gcTime: 1000 * 60 * 60 * 12,
|
||||||
queryFn: ({ signal }) => {
|
queryFn: ({ signal }) => {
|
||||||
return api.controller
|
return api.controller
|
||||||
.getArtistList({
|
.getArtistList({
|
||||||
@@ -77,6 +80,7 @@ export const artistsQueries = {
|
|||||||
args.serverId,
|
args.serverId,
|
||||||
Object.keys(args.query).length === 0 ? undefined : args.query,
|
Object.keys(args.query).length === 0 ? undefined : args.query,
|
||||||
),
|
),
|
||||||
|
staleTime: 1000 * 60 * 60 * 12,
|
||||||
...args.options,
|
...args.options,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export const genresQueries = {
|
|||||||
},
|
},
|
||||||
listCount: (args: QueryHookArgs<ListCountQuery<GenreListQuery>>) => {
|
listCount: (args: QueryHookArgs<ListCountQuery<GenreListQuery>>) => {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
|
gcTime: 1000 * 60 * 60 * 12,
|
||||||
queryFn: ({ signal }) => {
|
queryFn: ({ signal }) => {
|
||||||
return api.controller
|
return api.controller
|
||||||
.getGenreList({
|
.getGenreList({
|
||||||
@@ -39,6 +40,7 @@ export const genresQueries = {
|
|||||||
args.serverId,
|
args.serverId,
|
||||||
Object.keys(args.query).length === 0 ? undefined : args.query,
|
Object.keys(args.query).length === 0 ? undefined : args.query,
|
||||||
),
|
),
|
||||||
|
staleTime: 1000 * 60 * 60 * 12,
|
||||||
...args.options,
|
...args.options,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export const playlistsQueries = {
|
|||||||
},
|
},
|
||||||
listCount: (args: QueryHookArgs<ListCountQuery<PlaylistListQuery>>) => {
|
listCount: (args: QueryHookArgs<ListCountQuery<PlaylistListQuery>>) => {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
|
gcTime: 1000 * 60 * 60 * 12,
|
||||||
queryFn: ({ signal }) => {
|
queryFn: ({ signal }) => {
|
||||||
return api.controller.getPlaylistListCount({
|
return api.controller.getPlaylistListCount({
|
||||||
apiClientProps: { serverId: args.serverId, signal },
|
apiClientProps: { serverId: args.serverId, signal },
|
||||||
@@ -48,6 +49,7 @@ export const playlistsQueries = {
|
|||||||
args.serverId || '',
|
args.serverId || '',
|
||||||
Object.keys(args.query).length === 0 ? undefined : args.query,
|
Object.keys(args.query).length === 0 ? undefined : args.query,
|
||||||
),
|
),
|
||||||
|
staleTime: 1000 * 60 * 60 * 12,
|
||||||
...args.options,
|
...args.options,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export const songsQueries = {
|
|||||||
},
|
},
|
||||||
listCount: (args: QueryHookArgs<ListCountQuery<SongListQuery>>) => {
|
listCount: (args: QueryHookArgs<ListCountQuery<SongListQuery>>) => {
|
||||||
return queryOptions({
|
return queryOptions({
|
||||||
|
gcTime: 1000 * 60 * 60 * 12,
|
||||||
queryFn: ({ signal }) => {
|
queryFn: ({ signal }) => {
|
||||||
return api.controller.getSongListCount({
|
return api.controller.getSongListCount({
|
||||||
apiClientProps: { serverId: args.serverId, signal },
|
apiClientProps: { serverId: args.serverId, signal },
|
||||||
@@ -31,6 +32,7 @@ export const songsQueries = {
|
|||||||
args.serverId,
|
args.serverId,
|
||||||
Object.keys(args.query).length === 0 ? undefined : args.query,
|
Object.keys(args.query).length === 0 ? undefined : args.query,
|
||||||
),
|
),
|
||||||
|
staleTime: 1000 * 60 * 60 * 12,
|
||||||
...args.options,
|
...args.options,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user