use of com.zimbra.cs.account.CacheExtension in project zm-mailbox by Zimbra.
the class FlushCache method doFlushCache.
public static void doFlushCache(AdminDocumentHandler handler, Map<String, Object> context, FlushCacheRequest req) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Server localServer = Provisioning.getInstance().getLocalServer();
handler.checkRight(zsc, context, localServer, Admin.R_flushCache);
CacheSelector cacheSelector = req.getCache();
boolean allServers = cacheSelector.isAllServers();
boolean imapServers = cacheSelector.isIncludeImapServers();
String[] types = cacheSelector.getTypes().split(",");
for (String type : types) {
CacheEntryType cacheType = null;
try {
cacheType = CacheEntryType.fromString(type);
doFlush(context, cacheType, cacheSelector);
} catch (ServiceException e) {
if (cacheType == null) {
// see if it is a registered extension
CacheExtension ce = CacheExtension.getHandler(type);
if (ce != null) {
ce.flushCache();
} else {
throw e;
}
} else {
throw e;
}
}
}
if (imapServers) {
flushCacheOnImapDaemons(req, zsc);
}
if (allServers) {
flushCacheOnAllServers(zsc, req);
}
}
Aggregations