What are the practical interface data caching implementations at the front end?

  node.js, question

I hope to cache REST API data in the front end, but there are some scenarios that require cached versions and some scenarios that do not require caching.

Existing interfaces without cache are all implemented in the inside of store folder, which is roughly the following directory structure

export default user
 user.fetch = function () {
 return http.get(...) // Promise
 user.friends   ...
 user.add   ...

There are many interfaces such as fetch. Now I want to provide a way to cache the data from fetch. When calling, I can choose whether to fetch or retrieve it from the cache.

Fetch//priority hit cache.

The trouble is that http request returnsPromiseThe object is slightly complicated to handle, so I want to know if there are mature solutions in the front-end field, and I hope you can not stint.

We are looking forward to this solution and are paying close attention to it.