@Override public void configure(CacheProvider newType, Config config) { if (!cacheConfigSame(newType, config)) { node = newType.newNodeCache(logger, config, monitors); relationship = newType.newRelationshipCache(logger, config, monitors); } else { node.clear(); relationship.clear(); } this.type = newType; this.config = config; }
private boolean cacheConfigSame(CacheProvider type, Config config) { return this.type != null && this.type.getName().equals(type.getName()) && // Only reuse array caches, since the other ones are cheap to recreate HighPerformanceCacheProvider.NAME.equals(this.type.getName()) && mySettingIsSameAs(config, node_cache_array_fraction) && mySettingIsSameAs(config, relationship_cache_array_fraction) && mySettingIsSameAs(config, node_cache_size) && mySettingIsSameAs(config, relationship_cache_size); }
@Override public Cache<RelationshipImpl> relationship() { return provider.newRelationshipCache(logger, config, monitors); }
@Override public Cache<NodeImpl> node() { return provider.newNodeCache(logger, config, monitors); }