-
Notifications
You must be signed in to change notification settings - Fork 5
Caching
pm4j edited this page Jan 22, 2013
·
5 revisions
Pm4j supports caching for several UI aspects. A cache may be configured by an annotation:
@PmCacheCfg(value=CacheMode.ON) public final PmAttrInteger myAttr = new PmAttrIntgerImpl() { protected getValueImpl() { // … some expensive code. E.g. a service call …
You may define caches for multiple UI aspects:
@PmCacheCfg(title=CacheMode.ON, options=CacheMode.ON)
Caching is supported for the following UI aspects:
- visibility,
- enablement,
- title,
- value and
- options
You may cache all these UI aspects as follows:
@PmCacheCfg(all=CacheMode.ON)
A cached value will be calculated on the first request for the cached.
The cached value will be used until the cache gets cleared.
A cache may be cleared programmatically by using the method:
PmCacheApi.clearPmCache(myPm);
This call clears all cached values for the given PM and all of its child PMs.
Specific cache aspects may be cleared by using the varargs parameter of this method:
PmCacheApi.clearPmCache(myPm, CacheKind.ENABLEMENT, CacheKind.OPTIONS);
The following operations automatically clear cached values:
- A cached attribute value gets replaced by the new value if the
setValue()
orsetValueAsString()
method gets called. - A call to
PmBean.setPmBean()
andPmBean.reloadPmBean()
clears all caches within the related PM sub tree.