public Optional < CacheHit < Entity > > getIfPresent ( EntityType entityType , Object id ) { EntityKey key = EntityKey . create ( entityType , id ) ; return Optional . ofNullable ( cache . getIfPresent ( key ) ) . map ( cacheHit -> hydrate ( cacheHit , entityType ) ) ; }
Retrieves an entity from the cache if present .