Enable cache retrieval.
This commit is contained in:
parent
148a136bd2
commit
3b674f5e28
1 changed files with 15 additions and 15 deletions
30
uiharu.ts
30
uiharu.ts
|
@ -718,21 +718,21 @@ const requestHandler = async (req: Request): Response => {
|
||||||
await crypto.subtle.digest('SHA-256', new TextEncoder().encode(urlParamRaw))
|
await crypto.subtle.digest('SHA-256', new TextEncoder().encode(urlParamRaw))
|
||||||
);
|
);
|
||||||
const cacheKey = `uiharu:metadata:fv${formatVersion}:${urlHash}`;
|
const cacheKey = `uiharu:metadata:fv${formatVersion}:${urlHash}`;
|
||||||
// const cacheInfo = await cache.get(cacheKey);
|
const cacheInfo = await cache.get(cacheKey);
|
||||||
// if(cacheInfo !== undefined)
|
if(cacheInfo !== undefined)
|
||||||
// return new Response(
|
return new Response(
|
||||||
// brotliDecompressSync(cacheInfo.value),
|
brotliDecompressSync(cacheInfo.value),
|
||||||
// {
|
{
|
||||||
// status: 200,
|
status: 200,
|
||||||
// headers: {
|
headers: {
|
||||||
// ...headers,
|
...headers,
|
||||||
// ...{
|
...{
|
||||||
// 'Server-Timing': `metadata;dur=${(performance.now() - started).toFixed(6)}`,
|
'Server-Timing': `metadata;dur=${(performance.now() - started).toFixed(6)}`,
|
||||||
// 'X-Uiharu-State': 'cache',
|
'X-Uiharu-State': 'cache',
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// }
|
}
|
||||||
// );
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const json = JSON.stringify(
|
const json = JSON.stringify(
|
||||||
|
|
Loading…
Reference in a new issue