class NodeCache(nodes: Collection<Node> = emptySet())

A cache which can be used that lazy loading uses existing nodes instead of new ones

Parameters

nodes

already fetched nodes

Constructors

Link copied to clipboard
constructor(nodes: Collection<Node> = emptySet())

Properties

Link copied to clipboard

Internal representation of the loaded Nodes

Link copied to clipboard
val nodes: Set<Node>

The loaded Nodes, excluding deleted ones

Functions

Link copied to clipboard
fun add(node: Node)

Adds a node to the cache

Link copied to clipboard
fun <T : Node?> getOrAdd(node: T): T?

Gets the cached node equivalent to node, otherwise puts it into the cache If already marked as deleted, or provided null, return null