graphql-hive / graphql-hive/envelop
useResponseCache: invalidate cache all at once
- Dominant language
- No language data
- Stars
- 827
- Forks
- 132
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
If you don't setup a ttl at first, you may endup with a never invalidated cache even after adding new cache restriction in the config.
**Describe the solution you'd like**
Some very basic solution using the inMemoryCache but we should be generalised (proposed by @EmrysMyrddin):
```
import { createInMemoryCache, Cache } from '@graphql-yoga/plugin-response-cache'
export function createCache(): Cache {
let cache = createInMemoryCache()
return {
get: (...args) => cache.get(...args),
set: (...args) => cache.set(...args),
invalidate: (...args) => cache.invalidate(...args),
purge: () => {
cache = createInMemoryCache()
},
}
}
```
**Describe alternatives you've considered**
A custom implementation
**Additional context**
/
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.