@@ -41,13 +41,13 @@ export class S3Cache implements CacheStrategy {
41
41
)
42
42
}
43
43
44
- async get ( pageKey : string , cacheKey : string , ctx : CacheContext ) : Promise < CacheEntry | null > {
44
+ async get ( pageKey : string , cacheKey : string ) : Promise < CacheEntry | null > {
45
45
if ( ! this . client ) return null
46
46
47
47
const pageData = await this . client
48
48
. getObject ( {
49
49
Bucket : this . bucketName ,
50
- Key : `${ pageKey } /${ cacheKey } .${ ctx . isAppRouter ? CacheExtension . RSC : CacheExtension . JSON } `
50
+ Key : `${ pageKey } /${ cacheKey } .${ CacheExtension . JSON } `
51
51
} )
52
52
. catch ( ( error ) => {
53
53
if ( NOT_FOUND_ERROR . includes ( error . name ) ) return null
@@ -58,7 +58,7 @@ export class S3Cache implements CacheStrategy {
58
58
59
59
const response = await pageData . Body . transformToString ( 'utf-8' )
60
60
61
- return ctx . isAppRouter ? response : JSON . parse ( response )
61
+ return JSON . parse ( response )
62
62
}
63
63
64
64
async set ( pageKey : string , cacheKey : string , data : CacheEntry , ctx : CacheContext ) : Promise < void > {
@@ -82,6 +82,14 @@ export class S3Cache implements CacheStrategy {
82
82
ContentType : 'text/html'
83
83
} )
84
84
)
85
+ promises . push (
86
+ this . client . putObject ( {
87
+ ...input ,
88
+ Key : `${ input . Key } .${ CacheExtension . JSON } ` ,
89
+ Body : JSON . stringify ( data ) ,
90
+ ContentType : 'application/json'
91
+ } )
92
+ )
85
93
if ( ctx . isAppRouter ) {
86
94
promises . push (
87
95
this . client . putObject ( {
@@ -91,15 +99,6 @@ export class S3Cache implements CacheStrategy {
91
99
ContentType : 'text/x-component'
92
100
} )
93
101
)
94
- } else {
95
- promises . push (
96
- this . client . putObject ( {
97
- ...input ,
98
- Key : `${ input . Key } .${ CacheExtension . JSON } ` ,
99
- Body : JSON . stringify ( data . value . pageData ) ,
100
- ContentType : 'application/json'
101
- } )
102
- )
103
102
}
104
103
} else {
105
104
promises . push (
0 commit comments