Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable cache with makeUseAxios #199

Closed
fabn opened this issue Apr 4, 2020 · 5 comments · Fixed by #204
Closed

Option to disable cache with makeUseAxios #199

fabn opened this issue Apr 4, 2020 · 5 comments · Fixed by #204

Comments

@fabn
Copy link

fabn commented Apr 4, 2020

Following my request in #37 (comment) and #34 it would be nice to have this

For anyone interested here's a workaround for current version

# Use a cache with expire time of 50ms
export const useApi = makeUseAxios({axios: api, cache: new LRU({ max: 10, maxAge: 50 })});

Thanks

simoneb added a commit that referenced this issue Apr 11, 2020
simoneb added a commit that referenced this issue Apr 11, 2020
simoneb added a commit that referenced this issue Apr 11, 2020
simoneb added a commit that referenced this issue Apr 11, 2020
This feature introduces the ability to disable caching
entirely when using `configure` or `makeUseAxios`,
by setting the `cache` option to false:

```
// with configure
configure({ cache: false })

// with makeUseAxios
const useAxios = makeUseAxios({ cache: false })
```

fixes #199
@simoneb
Copy link
Owner

simoneb commented Apr 11, 2020

@fabn can you have a look at this PR? #204

@fabn
Copy link
Author

fabn commented Apr 11, 2020

I think is fine, as soon as you release it I'll test it.

Thanks.

@simoneb
Copy link
Owner

simoneb commented Apr 11, 2020

@fabn I published a prerelease, [email protected]. Can you try it out before I do an official release?

@fabn
Copy link
Author

fabn commented Apr 12, 2020

@simoneb I tried it and it's working as expected. Thanks.

@simoneb
Copy link
Owner

simoneb commented Apr 13, 2020

@fabn thanks for checking. Now released as 1.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants