diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java index fa397862f4..fed55dc8f7 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedGraphTransaction.java @@ -203,6 +203,11 @@ private void notifyChanges(String action, HugeType type, Id[] ids) { graphEventHub.notify(Events.CACHE, action, type, ids); } + private void notifyChanges(String action, HugeType type) { + EventHub graphEventHub = this.params().graphEventHub(); + graphEventHub.notify(Events.CACHE, action, type); + } + private void clearCache(HugeType type, boolean notify) { if (type == null || type == HugeType.VERTEX) { this.verticesCache.clear(); @@ -212,7 +217,7 @@ private void clearCache(HugeType type, boolean notify) { } if (notify) { - this.notifyChanges(Cache.ACTION_CLEARED, null, null); + this.notifyChanges(Cache.ACTION_CLEARED, null); } } @@ -403,7 +408,7 @@ protected final void commitMutation2Backend(BackendMutation... mutations) { if (invalidEdgesCache && this.enableCacheEdge()) { // TODO: Use a more precise strategy to update the edge cache this.edgesCache.clear(); - this.notifyChanges(Cache.ACTION_CLEARED, HugeType.EDGE, null); + this.notifyChanges(Cache.ACTION_CLEARED, HugeType.EDGE); } } } @@ -417,7 +422,7 @@ public final void removeIndex(IndexLabel indexLabel) { if (indexLabel.baseType() == HugeType.EDGE_LABEL) { // TODO: Use a more precise strategy to update the edge cache this.edgesCache.clear(); - this.notifyChanges(Cache.ACTION_CLEARED, HugeType.EDGE, null); + this.notifyChanges(Cache.ACTION_CLEARED, HugeType.EDGE); } } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java index 8c42b28950..331b038df8 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/backend/cache/CachedSchemaTransaction.java @@ -142,6 +142,11 @@ private final void notifyChanges(String action, HugeType type, Id id) { graphEventHub.notify(Events.CACHE, action, type, id); } + private final void notifyChanges(String action, HugeType type) { + EventHub graphEventHub = this.params().schemaEventHub(); + graphEventHub.notify(Events.CACHE, action, type); + } + private final void resetCachedAll(HugeType type) { // Set the cache all flag of the schema type to false this.cachedTypes().put(type, false); @@ -165,7 +170,7 @@ private final void clearCache(boolean notify) { this.arrayCaches.clear(); if (notify) { - this.notifyChanges(Cache.ACTION_CLEARED, null, null); + this.notifyChanges(Cache.ACTION_CLEARED, null); } }