@@ -17,6 +17,11 @@ import { Avatar, AvatarFallback } from '@/components/ui/avatar'
1717import { Button } from '@/components/ui/button'
1818import { Verify } from '@/lib/firebase/firebase'
1919import { DataRecentBorrows } from '@/components/books/DataRecentBorrows'
20+ import {
21+ CACHE_KEY_BORROWS ,
22+ CACHE_KEY_REVIEWS ,
23+ CACHE_TTL_SECONDS ,
24+ } from '@/lib/consts'
2025
2126export default async function BookDetailsPage ( {
2227 params,
@@ -31,8 +36,28 @@ export default async function BookDetailsPage({
3136
3237 const [ bookRes , reviewsRes , borrowsRes ] = await Promise . all ( [
3338 getBook ( { id, include_stats : 'true' } ) ,
34- getListReviews ( { book_id : id , limit : 3 } , { headers } ) ,
35- getListBorrows ( { book_id : id , limit : 3 } , { headers } ) ,
39+ getListReviews (
40+ { book_id : id , limit : 3 } ,
41+ {
42+ headers,
43+ cache : 'force-cache' ,
44+ next : {
45+ tags : [ CACHE_KEY_REVIEWS , id ] ,
46+ revalidate : CACHE_TTL_SECONDS ,
47+ } ,
48+ }
49+ ) ,
50+ getListBorrows (
51+ { book_id : id , limit : 3 } ,
52+ {
53+ headers,
54+ cache : 'force-cache' ,
55+ next : {
56+ tags : [ CACHE_KEY_BORROWS , id ] ,
57+ revalidate : CACHE_TTL_SECONDS ,
58+ } ,
59+ }
60+ ) ,
3661 ] )
3762
3863 if ( 'error' in bookRes ) {
0 commit comments