ObjectBox 中与 self class 的一对多关系会导致整个树加载吗?

Do One to Many relationship to self class in ObjectBox cause entire tree loads?

我正在尝试在 ObjectBox 中对树状数据结构建模,其中树中的每个节点都有一些内容。

然而,在阅读 tutorial 时它说:

Note that to-many relations are resolved lazily on the first request, and then cached in the source entity inside the ToMany object.

这是否意味着如果我有一个巨大的树结构并加载顶级节点,它会在一个节点下解析整个树?如果是这样,内存使用是否聪明,所以如果树很大,我不会 运行 内存不足?如果我有几个字段,其中一些字段可能很大,当我引用节点时它会加载所有字段,还是只加载我要求的节点部分?

您可能在描述 "eager loading"。相反,ObjectBox 默认为 "lazy loading",只有在您访问它们时才加载数据。

如果您担心缓存字段的内存使用情况,可以使用 reset().

清除缓存值