From: Wolfgang M. <wol...@gm...> - 2005-11-10 10:20:06
|
> When we insert a item into the cache (e.g. LRUCache), > how do we know that the item stays really in main > memory and not being replaced by something else. I > have been searching the Web, but I haven't found > anything that describes how to force an object to stay > in main memory in Java. Does Java have such a feature, > if it does not, how is it implemented in Exist? It sounds like you are directly using LRUCache in your application? The main purpose of LRUCache (and all the other caches in org.exist.storage.cache) is to limit the number of data pages kept in memory in the most optimal way. The replacement policy of the cache determines when a page will be removed. eXist's cache implementations use different replacement policies. LRUCache is the most simple one. If you want to keep everything in memory, you should not use LRUCache at all, but rather implement your own caching class. For Java, some general-purpose caching libraries are available, e.g. ehcache or the caching package from JBoss. Wolfgang |