lefengyang
2026-08-20 d01a28cb030b2cb0ff1d42273c877a0f728519a6
1
2
3
4
5
6
7
8
9
10
11
12
import {StorageLocal} from "gs-br-ext";
 
export async function cacheFetch(   input: string | URL | globalThis.Request,init?: RequestInit): Promise<Response> {
    init || (init = {});
    init.cache = await StorageLocal.getValue('cache')
    console.log(new Date().toLocaleTimeString(),'cache:',init.cache,',execute url=', input)
    return await fetch(input, init);
}
 
export async function isCache() {
    return 'force-cache' === await StorageLocal.getValue('cache');
}