Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:58:25+00:00 2026-06-03T14:58:25+00:00

As said in EhCache documentation : In practice this means that persistent in-memory cache

  • 0

As said in EhCache documentation:

In practice this means that persistent in-memory cache will start up with all of its elements on disk. […] So, the Ehcache design does not load them all into memory on start up, but lazily loads them as required.

I would like that the memory cache start up will all its elements in memory, how can I achieve that?

The reason for this is that our website performs a lot of access to the cache, so the first time we visit the website it has very bad response time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:58:26+00:00Added an answer on June 3, 2026 at 2:58 pm

    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.

    I am just giving idea where we load DiskStore into memeory after the application is started

    You can implement BootstrapCacheLoader which will load the cache elements as below. Definition of the method BootstrapCacheLoader.load(Ehcache cache) can be

           //CustomBootstrapCacheLoader implements BootstrapCacheLoader
    
    
            List<?> keys = cache.getKeys();
    
            if ((keys == null) || keys.isEmpty())
            {
                return;
            }
    
            for (Object key : keys)
            {
               Element el = cache.getQuiet(key);
               cache.removeQuiet(key);
               cache.putQuiet(el);
            }
    

    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.

    Implement BootstrapCacheLoaderFactory so that

    public class CustomBootstrapCacheLoaderFactory extends BootstrapCacheLoaderFactor
    {
    .
    .
    @Override
    public BootstrapCacheLoader createBootstrapCacheLoader(Properties properties)
    {
        CustomBootstrapCacheLoader loader = new CustomBootstrapCacheLoader();
        loader.setAsynchronous(getAsyncFromProperty(properties));
    
        return loader;
    }
    .
    .
    }
    

    You can define cache configuration as below with CustomBootstrapCacheLoaderFactory as below

    <cache
             name="DummyCacheEl"
             maxElementsInMemory="3500"
             eternal="true"
             overflowToDisk="false"
             diskPersistent="true"
             memoryStoreEvictionPolicy="LRU">
             <bootstrapCacheLoaderFactory class="CustomBootstrapCacheLoaderFactory"  properties="async=true"/>
    </cache>  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

They said this expression is valid in C, and that it means calling a
As the title said: I would like to find all elements that are on
The manual said that The destructor method will be called as soon as all
Its said that property should not be Set only (Code analysis rule CA1044 )and
MSDN said that BlockingCollection.Take call blocks if there is no elements in it. Does
It is said that in the Spring javadoc article about DriverManagerDataSource class, that this
It is said, javascript clears a variable from memory after its being referenced last.
its said that 1 ViewModel has 1 View. 1 View is for me a
Title said it all. Some context: I got a search mechanism - search view,
Somebody said that when your PHP code and application use global variables then it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.