I'm testing the cache service I'm using in my application based on JBoss Cache and I have a strange problem.
I have selected LRU replacemente polityc, and I've created the following test.
I set a maximum number of nodes in cache, I fill them with data, then I read every one except one, then I insert one element more. Then the least frequently used (the one wich I didn't read) should be replaced with the new one inserted.
Well, that not happens. In fact, when I try to retrieve the node that not should be in cache (because it was replaced), it is in cache.
But if I start a debug session in Eclipse then the test ends correctly with the replaced node not found in cache.
What's happening with these?
How do you retrieve the node? cache.get()? Do you have a cache loader configured? What sort of eviction thread wakeup interval have you configured? Are you allowing enough time for the eviction thread to kick in and clean up nodes marked for eviction?