Custom Cache Instance

If you want to use say 3-4 different caches in your application or you want to better track your cache instance then you can create your own instance of dynamic cache and configure and use it.

You can create custom cache instance either using administrative console or declaratively using your application.

Administrative Console

YOu can create and configure new cache instance using WAS Administrative console. Inside the Administrative Console go to Resources -> Cache Instance -> Object Cache Instance and create a new cache instance like this

Using cacheinstance.properties

Other method of creating cache is that you can create cacheinstance.properties file like this in your WEB-INF/classes forlder. If your using RAD you can create in root of your source folder, so that it gets copied to WEB-INF/classes folder.


cache.instance.0=/wpcertification/cache/customCache
cache.instance.0.cacheSize=1000
cache.instance.0.enableDiskOffload=true
cache.instance.0.diskOffloadLocation=c:/temp/diskOffload
cache.instance.0.flushToDiskOnStop=true
cache.instance.0.useListenerContext=true
cache.instance.0.enableCacheReplication=false
cache.instance.0.disableDependencyId=false
cache.instance.0.htodCleanupFrequency=60

Inside your code you can access the distributed Map object using this code

distributedMap= (DistributedMap)context.lookup("/wpcertification/cache/customCache");

You can download the CustomDynaCache portlet and install it on your server. After installing it try accessing it couple of times and then check it in the CacheMonitor

Yorum (comment) (1)