refreshCache Option

Created on 5 May 2024, about 2 months ago

Problem/Motivation

Assuming that we have implemented a way to evict the cache β†’ , we can then expose an option on individual request methods to 'refresh' the cache. This will first evict the cache at the specified cache key, and then make a fresh API request that will then be cached.

Steps to reproduce

* Make a cached request.
* It lives in the cache forever.

Proposed resolution

* For methods that accept a getOptions object (getCollection, getResource, getResourceByPath in JsonApiClient, translatePath in DecoupledRouterClient) add a refreshCache option. If this is true, the cache at the resulting key will be evicted/removed and then the API call will proceed as normal.

Remaining tasks

* Update the getOptions interface to include a refreshCache option.
* Honor this option in JsonApiClient methods - getResource, getCollection, getResource by path.
* Honor this option in decoupledRouterClient methods - translatePath.
* Add test coverage.
* Update documentation.

API changes

* Get methods will now accept a refreshCache option.

✨ Feature request
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States brianperry

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024