I am trying to load all my Neo4j DB to the RAM so querying will work faster. When passing the properties map to the graph creation, I do not see the process taking more spac
Neo4j loads all the data lazily, meaning it loads them into memory at first access. The caching option is just about the GC strategy, so when (or if) the references will be GCed. To load the whole graph into memory, your cache type must be strong and you need to traverse the whole graph once. You can do it like this:
// untested java code
import org.neo4j.helpers.collection.IteratorUtil;
// ...
for(Node node : graph.getAllNodes()) {
IteratorUtil.count(node.getRelationships());
}
This way all nodes and relationships will be used once and thus loaded into the cache.