Skip to main content
`Ctrl`+`K`

# skbio.tree.TreeNode.has_caches

TreeNode.has_caches()

  Check if the current tree has caches.

  Added in version 0.6.3.

  Returns:
    set or None

      Names of present node attribute caches, or None if none is present.

    bool

      Presence (True) or absence (False) of node lookup caches.

  See also

  `clear_caches`
  `cache_attr`
  `find`

  Notes

  Caches are optional but can significantly accelerate certain analyses of the tree. Two types of caches may be created:

  1. Node attributes, which may be created by calling `cache_attr` and assigned to individual nodes within the tree. The names of these attributes are optionally registered at the root.

  2. Node lookup table, which is automatically created during the first node search (e.g., by calling `find`) and reused in subsequent searches. This table is attached to the root of the tree.

  This method checks if a node lookup table and any registered node attributes are present at the root node of the tree.

  The returned set of node attribute names is a reference instead of a copy. One may edit the set in place to explicitly enable/disable names. Use this feature with caution.

  When the tree is manipulated, caches typically become obsolete and are automatically cleared. If the caches are not present or not relevant to the analysis, you may set `uncache=False` when performing individual operations to suppress clearing. This can improve the performance of these operations.

  You may explicitly call `clear_caches` to clear caches of a tree.