Setting portlet caching values for a JSR 286 portlet | HCL Digital Experience

You can dynamically modify portlet caching parameters for a JSR 286 portlet during the render phase.

Procedure

Update the doHeaders call in the javax.portlet.CacheControl object to set the portlet caching parameters.
The following sample code sets the portlet's cache scope to private and the cache expiration time to a value of 30 seconds.
protected void doHeaders(RenderRequest request, RenderResponse response)
{
		response.getCacheControl().setExpirationTime(30);
		response.getCacheControl().setPublicScope(false);
}