-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Labels
enhancementNew feature or requestNew feature or request
Description
What's the best way to cache responses with ohmyfetch via an LRU cache?
With axios, I've used axios-extensions's "cacheAdapterEnhancer" like so:
import { cacheAdapterEnhancer } from 'axios-extensions';
import LRU from 'lru-cache';
const ONE_HOUR = 1000 * 60 * 60;
const defaultCache = new LRU({ maxAge: ONE_HOUR });
const defaults = $axios.defaults;
defaults.adapter = cacheAdapterEnhancer(defaults.adapter, {
enabledByDefault: false,
cacheFlag: 'useCache',
defaultCache,
});
which caches responses when I explicitly add useCache: true to the request.
Is there a similar enhancer for ohmyfetch, or one planned, or an example of how to implement caching with ohmyfetch?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request