code: def event_doctree_read(app, doctree):
      
      albums, images = set(), set()
      for node in (n for c in (ImgurTextNode, ImgurImageNode) for n in doctree.traverse(c)):
          if node.album:
              albums.add(node.imgur_id)
          else:
              images.add(node.imgur_id)
      initialize(app.builder.env.imgur_album_cache, app.builder.env.imgur_image_cache, albums, images)
docs: Called by Sphinx during phase 1 (reading).
  
      * Add new Imgur IDs to the cache.
  
      :param sphinx.application.Sphinx app: Sphinx application object.
      :param docutils.nodes.document doctree: Tree of docutils nodes.