private VocabularyTerm cacheTerm(String id, SolrDocument doc) { Cache<VocabularyTerm> cache = this.externalServicesAccess.getTermCache(this); VocabularyTerm term = cache.get(id); if (term == null) { term = new SolrVocabularyTerm(doc, this); cache.set(id, term); } return term; } }
Cache<VocabularyTerm> cache = this.externalServicesAccess.getTermCache(this); for (String id : ids) { VocabularyTerm cachedTerm = cache.get(id);
@Override public VocabularyTerm getTerm(String id) { if (StringUtils.isBlank(id)) { return null; } VocabularyTerm result = this.externalServicesAccess.getTermCache(this).get(id); if (result == null) { SolrQuery query = new SolrQuery(ID_FIELD_NAME + ':' + ClientUtils.escapeQueryChars(id)); SolrDocumentList allResults = this.search(query); if (allResults != null && !allResults.isEmpty()) { result = new SolrVocabularyTerm(allResults.get(0), this); this.externalServicesAccess.getTermCache(this).set(id, result); } else { this.externalServicesAccess.getTermCache(this).set(id, EMPTY_MARKER); } } return (result == EMPTY_MARKER) ? null : result; }
this.externalServicesAccess.getTermCache(this).removeAll();