Hi and what an awesome topic! We never really thought about caching responses. Current there is not a cache feature. Looking at the code now and there is really nothing you could do to speed the response up since the return is returning static files content basically.
Caching would require a DB call which I would assume would be a longer process. Allow me some time to look into this feature. If you have any ideas, please share.
It sounds like you may benefit from a faster server. What is the actual response time of the server compared to the response time of content?
Thread Starter
malczu
(@malczu)
Hey, thanks for the fast response. I was thinking about memory cache (maybe key-value redis like cache). I have saved /.well-known/keys json as a file and when I serve it as a static content it takes 30ms to download by the client, in comparison to around 1000ms when keys json is generated. But still /.well-known/openid-configuration/ points to dynamic /.well-known/keys endpoint so either all auto configured clients have to have override for keys endpoint url or I have to modify code to return my static file path as keys endpoint url.
Thanks!
I see. Thanks for your feedback. Purhaspse, we could come up with some form of Cache but given how the plugin is currently setup, I would not count on an actual cache feature just yet.
However, I would recommend looking into something like Opcache/ Another HUGE factor is your server environment. PHP 7 is crazy fast compared to 5.6. Also, if you are not using NGINX I advise your look into it.
The love the idea of caching things like this but right now I am not sure we will be able to provide a valid solution.
Wait….
You may be able to wright a hook into the wo_before_api action. You can then do you own request propcess and provide your static files. This will allow you to inject you own JSON keys. I am not sure on speed but it is a possibility.
At any rate, let me know how it goes. I am always excited to see solutions for future support.
Thread Starter
malczu
(@malczu)
Cool, thanks a lot for all the recommendations. Will definitely let you what I was able to do to speed it up!
Thanks a lot!