Closed laggu closed 4 months ago
@laggu You could build that using OnBeforeRequest
and OnAfterResponse
middleware.
@jeevatkm OnBeforeRequest only have request with argument. I need to access response with OnBeforeRequest and stop request without error
How to stop request on OnBeforeRequest and return response with cached data??
@laggu I'm not sure this could help, maybe give it try.
You could create a cache layer (pick any good cache library). Then you could access that cache instance in OnAfterResponse
to add the response to the cache; then before you fire the resty request, check your cache and to use it.
@jeevatkm I think caching api result is a common requirement for software Would you have any plan for support this feature? Support by middleware will be perfect, but adding function like retry is fine
I also have similar demands
Is there anyway to make a caching middleware?
I hope to make a response middleware that cache response with some special key and request middleware that get response from cache and skip the http request
is this possible??