I have asked a question in Software Engineering Stack Exchange.
I am refactoring a project which loads its all data from the mongo to the Java HashMap. The system writes both in the map and the mongo but read from the map only. It is like some kind of persistent map! The problem with this architecture is that it is not scalable with regards to memory.
I am looking for a Java Map implementation which is disk-based (not limited by RAM size).
WeakHashMap
. First query if the entry exists, if it exists and the data exists use it, otherwise (cache miss) run the query in Mongo and then cache the data in the Map for the next query?