translation = (Translation) countryValue.getObjectValue();
} else {
statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), false);
translation = getTranslation(entityType, entityId, property, localeCountryCode);
if (translation == null) {
translation = new TranslationImpl();
}
getCache().put(new Element(countryCacheKey, translation));
}
// If we don't find one, let's try just the language (en), again utilizing the cache
if (translation.getTranslatedValue()==null) {
String nonCountryCacheKey = getCacheKey(entityType, entityId, property, localeCode);
Element nonCountryValue = getCache().get(nonCountryCacheKey);
if (nonCountryValue != null) {
statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), true);
translation = (Translation) nonCountryValue.getObjectValue();
} else {
statisticsService.addCacheStat(CacheStatType.TRANSLATION_CACHE_HIT_RATE.toString(), false);
translation = getTranslation(entityType, entityId, property, localeCode);
if (translation == null) {
translation = new TranslationImpl();
}
getCache().put(new Element(nonCountryCacheKey, translation));
}
}