public Container getContainerByNameHelper(String accountName, String containerName) throws AccountServiceException {

    if (recentNotFoundContainersCache.contains(accountName + SEPARATOR + containerName)) {
      // If container was not found in recent get attempts, avoid another query to db and return null.
      return null;
    }

    Account account = getAccountByName(accountName);
    if (account == null) {
      return null;
    }
    Container container = account.getContainerByName(containerName);
    if (container == null) {
      // If container is not present in the cache, query from mysql db
      try {
        container = mySqlAccountStore.getContainerByName(account.getId(), containerName);
        if (container != null) {
          // write container to in-memory cache
          updateContainersInCache(Collections.singletonList(container));
          logger.info("Container {} in Account {} is not found locally; Fetched from mysql db", containerName,
              accountName);
          accountServiceMetrics.onDemandContainerFetchCount.inc();
        } else {
          // Add account_container to not-found LRU cache
          recentNotFoundContainersCache.add(accountName + SEPARATOR + containerName);
          logger.error("Container {} is not found in Account {}", containerName, accountName);
        }
      } catch (SQLException e) {
        throw translateSQLException(e);
      }
    }
    return container;
  }
Get an existing container from a given account.
@param accountName the name of account which container belongs to.
@param containerName the name of container to get.
@return the requested {@link Container} object or null if not present.
@throws AccountServiceException if exception occurs when getting container.
ambry-account/src/main/java/com/github/ambry/account/CachedAccountService.java