Jacl script to configure dynamic cache websphere

ibm websphere
Below give JACL script can be used to enable dynamic cache in IBM WAS ND
#--------------------------------------------------------------------------------------
#--Configuring dynamic cache 
#--------------------------------------------------------------------------------------

set aServer [$AdminConfig getid /Node:$nodeName/Server:$serverName/]
set aDynamicCache [$AdminConfig list DynamicCache $aServer]

# setting up DynamicCache attributes
set cSizeAttr [list cacheSize 2000]
set dpAttr [list defaultPriority 2]
set dolAttr [list diskOffloadLocation /myLoc]
set enableAttr [list enable true]
set enableDOLAttr [list enableDiskOffload true]
set repTypeAttr [list replicationType NONE]
set dynamicCacheAttrs [list $cSizeAttr $dpAttr $dolAttr $enableAttr $enableDOLAttr $repTypeAttr]

# check if there is existing dynamic cache
if {[llength $aDynamicCache] != 0}} {
# modify dynamic cache properties
puts "Modify existing dynamic cache properties"
$AdminConfig modify $aDynamicCache $dynamicCacheAttrs
puts [$AdminConfig showall $aDynamicCache]
} else {
# create a dynamic cache object
puts "Create a new dynamic cache object"
set aDynamicCache [$AdminConfig create DynamicCache $aServer $dynamicCacheAttrs]
puts [$AdminConfig showall $aDynamicCache]
}

# setting up external cache group
set memberAttr [list members [list [list [list adapterBeanName myAdapterBeanName] [list address myAddress]]]]
set nameAttr [list name myECG]
set typeAttr [list type SHARED]
set externalCacheGroupAttrs [list $memberAttr $nameAttr $typeAttr]

set extCacheGps [lindex [$AdminConfig showAttribute $aDynamicCache cacheGroups] 0]
# check if there is existing external cache group named myECG
set found false
foreach aExtCacheGp $extCacheGps {
if {[$AdminConfig showAttribute $aExtCacheGp name] == "myECG"} {
set found true
break
}
}

if {$found == "false"} {
# create an external cache group
puts "Create a new external cache group"
set newExtCacheGp [$AdminConfig create ExternalCacheGroup $aDynamicCache $externalCacheGroupAttrs
puts [$AdminConfig showall $newExtCacheGp]
}
$AdminConfig show

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.