feat: support a way to override fetching behavior
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no specific file or test. Start by locating ofetch's request entry point and existing request-option documentation, then determine whether the intended result is a supported caching override or an implementation example; done should be a documented, testable resolution to that choice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100