示例#1
0
  /**
   * Deletes the ApiKey from the database
   *
   * @param key
   */
  public void deleteKey(String key) {
    List<ApiKey> apiKeys = getApiKeys();
    for (ApiKey apiKey : apiKeys) {
      if (apiKey.getKey().equals(key)) {
        // Found the right key. Delete from database
        apiKey.deleteApiKey(dbName);

        // Also delete key from the cache
        apiKeyCache.remove(key);

        // Found the key so done here
        return;
      }
    }

    // That key not found in database so report error
    logger.error("Could not delete key {} because it was not in database", key);
  }