Expand my Community achievements bar.

SOLVED

dispatcher cache servlet request ?

Avatar

Level 2

Hello,

Can the dispatcher be configured to cache requests to custom servlets?  Is this standard practice?

Is it typical for the dispatcher to cache publish instance requests to custom servlets that return a JSON repsonse?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

You would normally use a servlet to return data based on your arguments. As such the request would never be cached. 

Taking your use case, you want a servlet response to be cached, in which case this sounds like reference data, because it is being cached and will not change. In this scenario why not store this content in a node and use a component to generate the output required?

Regards,

Opkar

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

Hi,

You would normally use a servlet to return data based on your arguments. As such the request would never be cached. 

Taking your use case, you want a servlet response to be cached, in which case this sounds like reference data, because it is being cached and will not change. In this scenario why not store this content in a node and use a component to generate the output required?

Regards,

Opkar

Avatar

Level 7

Generally as the servlet response depends on the input which will be sent to the servlet and so it generates the response based on the input that servlet received and it is dynamic. It is not a good practice to cache the dynamic response.