kasia icon indicating copy to clipboard operation
kasia copied to clipboard

Add a mechanism for caching queries

Open nickpalmer opened this issue 8 years ago • 4 comments

In a SPA if I navigate back Kasia shouldn't have to re-run the queries to build the page.

nickpalmer avatar Oct 19 '17 20:10 nickpalmer

This probably needs some way to specify a 'cache-key' and an expiration time as a portion of the API. Maybe an optional third function to the connect calls that returns those values?

nickpalmer avatar Oct 19 '17 20:10 nickpalmer

It might be possible by creating an "intercept transport" for the node-wpapi library that does something like hashing the final request URL and storing that as the cache-key. Before each request is fired, we check if the hash is different. Something like that?

sdgluck avatar Nov 05 '17 15:11 sdgluck

We have a similar need, and are likely going to try to integrate node-redis into that transport method. I believe this is the prescribed approach. Here's an example for reference: https://github.com/WP-API/node-wpapi#customizing-http-request-behavior

MickeyKay avatar Jan 10 '18 00:01 MickeyKay

Somewhat related: https://github.com/outlandishideas/kasia/issues/77

MickeyKay avatar Feb 02 '18 07:02 MickeyKay