Usage of expiration-cache tag in portlet.xml

0 comments



Caching of content is very important aspect of portlet applications and can significantly improve the response-time of a portlet.

expiration-cache in deployment descriptor of the portlet can be set. This entry allows a portlet to cache content for a specified interval of time.

Additionally Portlet Render Response object can be used to override the time specified in the deployment descriptor of portlet by using the expiration-cache property:

portletRenderResponse.setProperty(expiration-cache, time);

The static portlets - for which the data is always same, can be cached. Identify the static portlets in your project and set the cache to never expire. It can be set in two ways, one is through expiration-cache tag in portlet.xml Or through Portal Server admin console setting.

a) In Portlet.xml:

<expiration-cache>-1</expiration-cache>

or

Portlet.xml
Settings


Note, that the time is entered in seconds, and setting the time to -1 means the cache will never expire, and setting the cache to zero, 0, means the caching mechanism for the portlet is completely disabled.

b) In Portal Server admin console:

Portal Server Console
Portal Server Console


Think about the life expectancy of your portlet content, and set an expiration-cache tag appropriately.

No comments:

Post a Comment

Recent Posts

Popular Posts

© 2011-2019 Web Portal Club