SuperMarvinLee commented on issue #2626: URL: https://github.com/apache/incubator-hugegraph/issues/2626#issuecomment-2272530866
> ```java > VERTEX_CACHE_CAPACITY > ``` > @SuperMarvinLee 你好,我是 [Dosu](https://dosu.dev)。我是一个可以帮助你解决 bug、回答问题并成为贡献者的机器人。我在这里帮助你等待人类维护者的时候。 > > 要在 HugeGraph 图数据库中完全禁用点和边的缓存功能,可以通过配置文件进行设置。以下是一个可能的配置示例: > > ```yaml > # conf/hugegraph.properties > > # Disable vertex cache > cache.vertex.capacity=0 > cache.vertex.expire=0 > > # Disable edge cache > cache.edge.capacity=0 > cache.edge.expire=0 > ``` > > 将 `cache.vertex.capacity` 和 `cache.edge.capacity` 设置为 `0`,并将 `cache.vertex.expire` 和 `cache.edge.expire` 设置为 `0`,可以有效地禁用顶点和边的缓存功能[[1]](https://github.com/apache/incubator-hugegraph-doc/blob/master/content/cn/docs/changelog/hugegraph-0.11.2-release-notes.md)。 > > 此外,代码注释中也解释了当 `cache.vertex.capacity` 和 `cache.edge.capacity` 设置为 `0` 时的默认行为: > > ```java > public static final ConfigOption<Long> VERTEX_CACHE_CAPACITY = > new ConfigOption<>( > "vertex.cache_capacity", > "The max cache size(items) of vertex cache.", > rangeInt(0L, Long.MAX_VALUE), > (1000 * 1000 * 10L) > ); > > public static final ConfigOption<Long> EDGE_CACHE_CAPACITY = > new ConfigOption<>( > "edge.cache_capacity", > "The max cache size(items) of edge cache.", > rangeInt(0L, Long.MAX_VALUE), > (1000 * 1000 * 1L) > ); > ``` > > `rangeInt(0L, Long.MAX_VALUE)` 表示容量可以设置为 `0`,这意味着可以通过将容量设置为 `0` 来禁用缓存[[2]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/config/CoreOptions.java)。 > > 当缓存被禁用时,所有读写操作将直接与底层存储后端(如 RocksDB)进行交互,而不会使用任何内存缓存层[[3]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-rocksdb/src/main/java/org/apache/hugegraph/backend/store/rocksdb/RocksDBOptions.java)[[4]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-store/hg-store-core/src/main/java/org/apache/hugegraph/store/options/RaftRocksdbOptions.java)。 > > _To continue talking to [Dosu](https://dosu.dev), mention @dosu._ 好像在hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/cache/RamCache.java文件中,RamCache类的构造函数设置了vertex.cache_capacity和edge.cache_capacity的默认值为256,即便在配置中将它们设为0。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
