Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am assuming that all the cached elements are in the DiskStore and you want them to be in-memory as soon as the application is started. In anycase using BootStrapCacheLoader and BootstrapCacheLoaderFactory should be helpful.</p> <p>I am just giving idea where we load DiskStore into memeory after the application is started</p> <p>You can implement BootstrapCacheLoader which will load the cache elements as below. Definition of the method <strong><em>BootstrapCacheLoader.load(Ehcache cache)</em></strong> can be</p> <pre><code> //CustomBootstrapCacheLoader implements BootstrapCacheLoader List&lt;?&gt; keys = cache.getKeys(); if ((keys == null) || keys.isEmpty()) { return; } for (Object key : keys) { Element el = cache.getQuiet(key); cache.removeQuiet(key); cache.putQuiet(el); } </code></pre> <p>Above method reads the element from DiskCache, Removes it and Puts it back so that it stays in the memory and disk version is removed.</p> <p>Implement BootstrapCacheLoaderFactory so that </p> <pre><code>public class CustomBootstrapCacheLoaderFactory extends BootstrapCacheLoaderFactor { . . @Override public BootstrapCacheLoader createBootstrapCacheLoader(Properties properties) { CustomBootstrapCacheLoader loader = new CustomBootstrapCacheLoader(); loader.setAsynchronous(getAsyncFromProperty(properties)); return loader; } . . } </code></pre> <p>You can define cache configuration as below with CustomBootstrapCacheLoaderFactory as below</p> <pre><code>&lt;cache name="DummyCacheEl" maxElementsInMemory="3500" eternal="true" overflowToDisk="false" diskPersistent="true" memoryStoreEvictionPolicy="LRU"&gt; &lt;bootstrapCacheLoaderFactory class="CustomBootstrapCacheLoaderFactory" properties="async=true"/&gt; &lt;/cache&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload