ArgumentChecker.notNull(versionCorrection, "versionCorrection");
final Object searchKey = Arrays.asList("single", clazz, configName, versionCorrection);
final Element element = _configCache.get(searchKey);
if (element != null) {
final ConfigDocument doc = (ConfigDocument) EHCacheUtils.get(element);
if (doc != null) {
return (R) doc.getConfig().getValue();
} else {
return null;
}
}
try {
final ConfigSearchRequest<R> searchRequest = new ConfigSearchRequest<R>(clazz);
searchRequest.setName(configName);
searchRequest.setVersionCorrection(versionCorrection);
final ConfigDocument doc = getMaster().search(searchRequest).getFirstDocument();
putValue(searchKey, doc, _configCache);
if (doc != null) {
putValue(doc.getUniqueId().getObjectId(), doc, _configCache);
putValue(doc.getUniqueId(), doc, _configCache);
return (R) doc.getConfig().getValue();
} else {
return null;
}
} catch (final RuntimeException ex) {
return EHCacheUtils.<R>putException(searchKey, ex, _configCache);