!--a11y-->
ICachablePortalComponent Interface 
Provides methods to control the cache expiration and caching level.
public boolean hasExpired( IPortalComponentRequest request, long creationTime, long currentTime) |
It returns true if the cache has expired. If this method is not implemented then a default implementation is called from AbstractPortalComponent and looks for the ValidityPeriod property.
public CachingLevel getCachingLevel(IPortalComponentRequest request) |
Returns a CachingLevel object representing one of the three values described above.
For example, a component can change its CachingLevel at runtime and decide not to be cached depending on request parameters. If this method is not implemented, a default implementation from AbstractPortalComponent looks for the CachingLevel property.
import com.sapportals.portal.prt.component.*;
public class MyComponent extends AbstractPortalComponent implements ICachablePortalComponent { public boolean hasExpired( IPortalComponentRequest request, long creation, long current) { if ((current - creation) > 10000) { return true; } return false; }
public void doContent( IPortalComponentRequest request, IPortalComponentResponse response) { long current = java.lang.System.currentTimeMillis(); response.write("<H2>" + new java.util.Date(current) + "</H2>"); } } |
