Skip to Content
Former Member
Nov 22, 2004 at 04:42 PM

iview caching on base of "ICacheValidator"


I try to redefine the caching for my portal component, by using ICacheValidator. Although i implemented the functions "isCacheValid" and "getValidationKey" it seems as if these functions are not used.

At last i tried to run following simple program, where still none of the 2 functions is called.

IView and page where created according to the comments in the code. Deployment descriptor is added as well further down.



import com.sapportals.portal.prt.component.*;

import com.sapportals.portal.prt.pom.IEvent;


  • How to implement caching functionality

  • 1. declare an iview property for the key in portalapp.xml

  • 2. retrieve this property for key computation

  • 3. implement ICacheValidator

  • 4. return custom computed key in getValidationKey()

  • 5. check current key to computed key in isCaheValid()

  • remarks: - first call to component/iview will deliver NULL as pagecache key

  • until iview property changes

  • - alway change properties on iview direct noct on deltalinks

  • iview properties:

  • CacheLevel: Shared

  • IsolationMode: Embedded

  • page properties:

  • CacheLevel: Shared

  • IsolationMode: URL


public class CachingIview extends AbstractPortalComponent implements ICacheValidator{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)





/* (non-Javadoc)

  • @see com.sapportals.portal.prt.component.ICacheValidator#isCacheValid(com.sapportals.portal.prt.component.IPortalComponentRequest, java.lang.String)


public boolean isCacheValid(IPortalComponentRequest request, String key) {

System.out.println("KEY: "+key);

return getKeyProperty(request).equals(key);


/* (non-Javadoc)

  • @see com.sapportals.portal.prt.component.ICacheValidator#getValidationKey(com.sapportals.portal.prt.component.IPortalComponentRequest)


public String getValidationKey(IPortalComponentRequest request) {

// TODO Auto-generated method stub

String key = getKeyProperty(request);

System.out.println("getValidationKey "+key);

return key;


/* (non-Javadoc)

  • @see com.sapportals.portal.prt.component.IPortalComponentInit#init(com.sapportals.portal.prt.component.IPortalComponentInitContext)


public void init(IPortalComponentInitContext arg0) {

// TODO Auto-generated method stub



private String getKeyProperty(IPortalComponentRequest request) {


return ""+request.getComponentContext().getProfile().getProperty("KeyProperty");

}catch(Exception e){

return "";





<?xml version="1.0" encoding="utf-8"?>




<component name="CachingIview">


<property name="ClassName" value=""/>

<property name="SecurityZone" value=""/>



<property name="KeyProperty" value="0"/>