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

  • Home
  • SEARCH
  • 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 8999607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:12:09+00:00 2026-06-16T00:12:09+00:00

I am planning on using a SelfPopulatingCache in my application component, as it supports

  • 0

I am planning on using a SelfPopulatingCache in my application component, as it supports read-through and what seems like a backing cache for refreshes.

However, I am a little bemused by the timeToLiveSeconds configuration. This is my test configuration:

<ehcache>
    <diskStore path="java.io.tmpdir"/>

    <cache name="myCache" maxElementsInMemory="50000" overflowToDisk="false"
    eternal="false" timeToIdleSeconds="0" timeToLiveSeconds="2"/>

</ehcache>

In my unit tests, I perform the following:

  • Verify there are 2 entries in my cache
  • Sleep for 3 seconds
  • However, after the sleep there are still 2 entries in my cache.

Per other posts online (and not the documentation), when I next perform a read, my entries should be evicted.

However, instead the CacheEntryFactory will be invoked, and a null Element will be added to the cache for my expired elements.

Is there any way to configure this to instead perform a full eviction when timeToLiveSeconds expires?

  • 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-16T00:12:10+00:00Added an answer on June 16, 2026 at 12:12 am

    I believe “full eviction” can only happen if there was a separate expiry thread. Unfortunately, for in-memory entries there’s no such thing. Quoting Ehcache FAQ:

    Because the MemoryStore has a fixed maximum number of elements, it
    will have a maximum memory use equal to the number of elements
    multiplied by the average size. When an element is added beyond the
    maximum size, the LRU element gets pushed into the DiskStore. While we
    could have an expiry thread to expire elements periodically, it is far
    more efficient to only check when we need to. The tradeoff is higher
    average memory use. The expiry thread keeps the DiskStore clean. There
    is hopefully less contention for the DiskStore’s locks because
    commonly used values are in the MemoryStore. We mount our DiskStore on
    Linux using RAMFS so it is using OS memory. While we have more of this
    than the 2GB 32-bit process size limit, it is still an expensive
    resource. The DiskStore thread keeps it under control. If you are
    concerned about CPU utilization and locking in the DiskStore, you can
    set the diskExpiryThreadIntervalSeconds to a high number, such as 1
    day. Or, you can effectively turn it off by setting the
    diskExpiryThreadIntervalSeconds to a very large value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m planning on using Ajax with my web application, but as I’m novice and
I am planning on using $.tmpl() for a rather large enterprise application. It appears
I've been planning on using GIT for version control. However, I have a prolly
I am working on a C application. I was planning on using a CSV
Im planning on using ASIHTTP to handle some long file downloads/installs and I'd like
ok i am planning on using the OpenID and i've read googles documentation and
I'm planning on using JavaScript to enter an informatics competition (BIO) tomorrow. However, I
I'm building an Ext.js application, and I'm planning on using rails for the backend.
I'm planning on using qActions for use globally in my application. The idea is
I'm using the Composite Application Library 's event aggregator, and would like to create

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.