public User resolveUser(final long userId) throws SQLException {
      metrics.userCacheTries.mark();
      User user = userCache.getIfPresent(userId);
      if(user != null) {
         metrics.userCacheHits.mark();
         return user;
      } else {
         user = selectUser(userId);
         if(user != null) {
            userCache.put(userId, user);
         }
         return user;
      }
   }
public User resolveUser ( final long userId ) throws SQLException { metrics . userCacheTries . mark ( ) ; User user = userCache . getIfPresent ( userId ) ; if ( user != null ) { metrics . userCacheHits . mark ( ) ; return user ; } else { user = selectUser ( userId ) ; if ( user != null ) { userCache . put ( userId , user ) ; } return user ; } }
Resolves a user by id, possibly with the internal cache.
@param userId The user id.
@return The user or {@code null}, if not found.
@throws SQLException on database error.