// Check Cache If Needed
String cacheKey = "repository_" + user + "_" + repository;
try {
if (useCache) {
Repository cachedObject = Cache.get(cacheKey, Repository.class);
if (cachedObject != null) {
return cachedObject;
}
}
} catch (Throwable t) {
// We don't want application failing because cache lookup didn't
// work
Logger.error(ExceptionUtil.getStackTrace(t));
}
// Cache Not Found - Hit Remote Service
Repository results = asObject(Repository.class, "repository", repositoryCheckPattern, user, repository);
// Set Cache
try {
Cache.set(cacheKey, results, cacheExpiration);
} catch (Throwable t) {