We have a requirement where in we want to cache the servlet(AEM) response.
Servlet is making a REST call to third party to fetch a response which is constant(response remains same)
Response of the servlet to be cached:
Servlet : /bin/servletpathname?queryParam=apiurl.
From clientside, we are making an ajax call to /bin/servletpathaname/apiurl/a.html (a.html is being appended so that the request has an extension.).
At Dispatcher We
are using internal redirect to redirect /bin/servletpathaname/apiurl/a.html to /bin/servletpathname?queryParam=apiurl.
We are able to get a successful response back from servlet (Internal Redirect is successful). But at dispatcher we observe that the request is not getting cached.
Am I missing something?
I want to understand how can we cache the servlet response, this would greatly reduce the load on the end server and improve performance.
If the article changes(data changes from servlet changes), We are exposing another servlet which will be used to invalidate the cache.
Is this question answered ? As I am also trying to do something similar however I am trying to cache service response.
This URL is a calls AEM servlet internally using httpclient and bring tons of data in json format, (static data). Since it is taking a minute or more to return the response, I want to cache it at dispatcher.
How I can proceed with ?