Flask-JSGlue icon indicating copy to clipboard operation
Flask-JSGlue copied to clipboard

Optional caching?

Open imaia opened this issue 7 years ago • 4 comments

An optional integration with flask-cache could do some wonders here.

imaia avatar Jan 12 '17 13:01 imaia

Can you explain a little bit more about this? 😁

stewartpark avatar Jan 19 '17 16:01 stewartpark

Yeap; if the js file is served by the view, it would be nice to have that response cached. With SPA's, caching this particular view is not a big problem, but with non-spa websites, it could quite help avoid unnecessary requests to the view.

Something like:

FLASK_GSGLUE_USE_CACHE = True

Then jsglue could lookup if flask-cache is installed and use it if available.

Another option would be to cache the view response with the http server cache. I'm unsure about which solution would fit best. Maybe having both options would be nice.

imaia avatar Jan 19 '17 19:01 imaia

Another approach would be to create an option to disable adding gluejs route. This way, the user could add a route to gluejs with caching enabled.

imaia avatar Feb 07 '17 17:02 imaia

@imaia is right on the money. I have a site that is an RPA "reduced page application", but still has some page loads... I chose to abandon JSGlue because of this. Also the nginx req limiter had to be raised just a tad to accomodate this JS or else it would get queued. If there was a way to cache the spun JS, I woulda liked to keep it. Its still a good idea.. just needs some tuning methinks. Good luck!

pbrackin avatar Mar 20 '17 20:03 pbrackin