Runtime tools : Core components : Externalizers : Tasks : Enabling the object cache
  
Enabling the object cache
To use the object cache, do one of the following:
Enable the object cache for formats and processors by setting the value of the appropriate field in the initialization keyed collection. This keyed collection is within the main settings keyed collection of the toolkit configuration file. The following example enables the object cache for the formats and processors:
<kColl id="initialization">
<field id="enableFormatsCache" value="true"/>
<field id="enableProcessorsCache" value="true"/>
...
</kColl>
Enable the caching feature for a specific object using the setCacheEnabled(boolean) method of the object's externalizer. For example, to cache format elements, call the FormatExternalizer.setCacheEnabled(true) method. After calling this method, every call to either FormatElement.readObject(String) or FormatExternalizer.convertTagToObject(Tag) causes the externalizer to search the cache for the desired object. The externalizer calls the reinitialize method to reset the object's attributes to their initial state and then returns the object. If the object is not in the cache, the externalizer creates it and then returns it.
To return an object to the cache after use, call the putIntoCache(Cacheable) method of the object's externalizer. For example, to put a format element into the cache, call the FormatExternalizer.putIntoCache(Cacheable) method.
To clear the cache because it is getting too large or it contains objects that the toolkit will not reuse, use the clearCache method of an externalizer. This removes the objects that the externalizer created. For example, if you call the clearCache method of the Format externalizer, the method removes all Format objects from the cache.
Go up to
Tasks