由于某种原因axios-cache-adapter,没有缓存GET文件下载请求,我认为这是由于responseType: 'blob'axios 生成 src 所需的设置(因为我对不需要设置此字段的其他请求没有缓存问题)网址(根据这个答案):
src: URL.createObjectURL(new Blob([response.data])),
我的适配器设置如下:
// set axios defaults
axios.defaults.headers.common = {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
};
const configureAxios = async () => {
await localforage.defineDriver(memoryDriver);
const forageStore = localforage.createInstance({
driver: [
localforage.INDEXEDDB,
localforage.LOCALSTORAGE,
memoryDriver._driver
],
name: 'my-cache'
});
return setup({
// `axios-cache-adapter` options
cache: {
maxAge: 15 * 60 * 1000,
exclude: {
query: false
},
store: forageStore,
}
});
};
// call this function in …Run Code Online (Sandbox Code Playgroud) 在函数标题/ prototype之后const之前和const之间有什么区别?另外在下面的例子中做什么?
例如.
const E& top() const throw(StackEmpty);
Run Code Online (Sandbox Code Playgroud)