- Create an Automation Script without launch point that accepts a parameter "cachename".
- It refreshes a specific cache or all caches in all servers
from psdi.util import MXException
from psdi.server import MXServer
cache = request.getQueryParam("cachename");
notvalid= True;
# Refresh a specific Maximo cache in all servers
if (cache != 'all' and cache is not None):
notvalid = False;
try:
ALL_SERVERS = True
MXServer.getMXServer().reloadMaximoCache(cache, ALL_SERVERS)
bodyMessage = "\"" + cache + " Refreshed in all Servers\""
responseBody = '{' + "\"response\"" + ": " + bodyMessage + '}';
except MXException, err:
print "---| CACHEREFRESH ::: refreshcache : "+str(err);
responseBody = '{"response": "error", "error": "'+str(err)+'"}';
# Refresh All Maximo Caches in all servers
if (cache=='all' and cache is not None):
notvalid = False;
try:
ALL_SERVERS = True
server = MXServer.getMXServer()
cacheNames = server.getMaximoCacheNames()
for cacheName in cacheNames:
server.reloadMaximoCache(cacheName,ALL_SERVERS)
responseBody = '{"response": "All Maximo Caches Refreshed"}';
except MXException, err:
print "---| CACHEREFRESH ::: refreshcache : "+str(err);
responseBody = '{"response": "error", "error": "'+str(err)+'"}';
# input param is not valid
if (notvalid):
responseBody = '{"response": "noactionpresent"}';
Code - cacherefresh.py
- Invoke the automation script via https REST API GET call with query parameter "cachename"
MAXEXTIFACEOUT), refreshing during normal business hours is not recommended. Doing so can disrupt live transactions coming from middleware, as they may not receive the latest cache data. It’s best to schedule these cache refresh operations during off-peak or after-hours periods when transaction volumes are minimal.https://hostname/maximo/api/service/security?action=wsmethod:clearProfileCache&lean=1
JSON Body for this API:
{ "userID": "MAXADMIN" }










