axios-cache-adapter | Store request results | Caching library
kandi X-RAY | axios-cache-adapter Summary
kandi X-RAY | axios-cache-adapter Summary
Caching adapter for axios. Store request results in a configurable store to prevent unneeded network requests.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Setup adapter .
- Creates new instance of adapter .
- Rewrite async response
- Creates a promise that is resolved with cached data .
- Evaluate the delegate .
- Invoke generator .
- Creates a Promise .
- Writes data to storage .
- Read items from cache .
- limit to storage
axios-cache-adapter Key Features
axios-cache-adapter Examples and Code Snippets
Community Discussions
Trending Discussions on axios-cache-adapter
QUESTION
For some reason axios-cache-adapter
is not caching GET
requests for file downloads which I believe is due to setting responseType: 'blob'
(as I don't have caching issues on other requests that don't require this field be set as such) which is required for axios to generate the src url(as per this answer):
src: URL.createObjectURL(new Blob([response.data])),
My adapter setup is as follows:
...ANSWER
Answered 2021-Sep-13 at 12:09@D-Money pointed me in the right direction. So basically axios-cache-adapter
v3 fixes the issue of not caching requests with responseType
blob
or arraybuffers
, however it's currently only available in beta so you'll have to install that as follows in the interim:
npm install axios-cache-adapter@beta
Then you'll have to make a slight adjustment by setting readHeaders: false,
in the axios-cache-adapter
options in setup
and additionally move the axios default config directly into setup
, which in my case results in the following net changes:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install axios-cache-adapter
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page