Search code examples
xodus

Disable caching in Xodus


I wonder, if it is possible to disable Xodus cache. I have this scenario - at certain moment I get bulk of data that I store into Xodus EntityStore. After this bulk is processed, I will never add anything else to this store. My idea is to disable caching for the period of feeding the store to get some performance bonus. Then close the store and reopen with changed environment config where caching will be enabled.


Solution

  • You don't have to reopen the database. Provided you have a PersistentEntityStore entityStore, to disable caching on that level, it's enough to do someting like this:

    entityStore.getConfig().setCachingDisabled(true);
    try {
        // feed the store
    }
    finally {
        entityStore.getConfig().setCachingDisabled(false);
    }