简体   繁体   中英

Which cache to choose Neo4j Cache or any other?

I am using neo4j 2.1.5 and SDN 3.2.2.

Hi I am developing a social networking web app, in which I am storing user social graph into neo4j database. Now I want to suggest recommendations for user, for that I want to cache the entire user social graph into cache. Can anyone tell me which cache to use neo4j object cache or any other memory cache(gauava, memcache etc..).

If neo4j Cache, Is this the right approach ?

@Autowired
   GraphDatabaseService graphdb;
   GlobalGraphOperations gop =  GlobalGraphOperations.at(graphdb);
   // Now to load all nodes into cache, do I have to traverse them.
   for (Node node : gop.getAllNodes()) {
      //to-do
   }

The first level cache is filesystem + memory mapping, which is crucial for fast i/o.

Neo4j's object cache (esp. if you use embedded) stores nodes and relationships (with cache_type=strong aggressively) will speed up your queries.

A third level cache could store your spring domain objects with their fetched relationships. You might just use Spring's @Cache annotation with guava, eh-cache or similar.

My colleague Max has some blog post on Neo4j and caching on the lower level: http://maxdemarzi.com/?s=caching

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM