/** * Caches a concept so it does not have to be rebuilt later. * * @param concept The concept to be cached. */ public void cacheConcept(Concept concept){ conceptCache.put(concept.id(), concept); if(concept.isSchemaConcept()){ SchemaConcept schemaConcept = concept.asSchemaConcept(); schemaConceptCache.put(schemaConcept.label(), schemaConcept); labelCache.put(schemaConcept.label(), schemaConcept.labelId()); } }
/** * Copies the {@link SchemaConcept} and it's subs into the {@link TxCache}. * This is important as lookups for {@link SchemaConcept}s based on {@link Label} depend on this caching. * * @param schemaConcept the {@link SchemaConcept} to be copied into the {@link TxCache} */ private void copyToCache(SchemaConcept schemaConcept) { schemaConcept.subs().forEach(concept -> { getGlobalCache().cacheLabel(concept.label(), concept.labelId()); getGlobalCache().cacheType(concept.label(), concept); }); }