Configuring portlet fragment caching with the wsadmin tool

We can configure portlet fragment caching with scripting and the wsadmin tool.

 

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

 

About this task

Important: If you use the wsadmin tool to enable portlet fragment caching, make sure that servlet caching is also enabled. Similarly if you use the wsadmin tool to disable portlet fragment caching, make sure that servlet caching is also disabled. The settings for these two caching functions must stay synchronized. If you enable or disable portlet fragment caching using the administrative console, synchronization is automatically taken care of for you.

 

Procedure

  1. Locate the server object. The following example selects the first server found:

    Using Jacl:

    set s1 [$AdminConfig getid /Server:server1/]
    

    Using Jython:

    s1 = AdminConfig.getid('/Server:server1/')
    
    

  2. List the Web containers and assign them to the wc variable, for example:

    Using Jacl:

    set wc [$AdminConfig list PortletContainer $s1]
    

    Using Jython:

    wc = AdminConfig.list('PortletContainer', s1)
    

  3. Set the enablePortletCaching attribute to true and assign it to the serEnable variable, for example:

    Using Jacl:

    set serEnable "{enablePortletCaching true}"
    

    Using Jython:

    serEnable = [['enablePortletCaching', 'true']]
    

  4. Enable caching, for example:

    Using Jacl:

    $AdminConfig modify $wc $serEnable
    

    Using Jython:

    AdminConfig.modify(wc, serEnable)
    


Related tasks
Configuring portlet fragment caching