[ 
https://issues.apache.org/jira/browse/JCS-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12581985#action_12581985
 ] 

Juan Vaccarezza commented on JCS-16:
------------------------------------

I inspected the code of the LRUMemoryCache and i've found that on the line 126 
it checks if the max object properties has been reached, and if so, cleans the 
cache. I guess that this is wrong cause it has to check if the amount of stored 
object has exccedes the max objects configured. 
Changin this lines 

// If the element limit is reached, we need to spool

if ( size < this.cattr.getMaxObjects() )
{
     return;
}

for these:

if ( size <= this.cattr.getMaxObjects() )
{
     return;
}

should make the trick.

> The jcs.default.cacheattributes.MaxObjects does not work as expected.
> ---------------------------------------------------------------------
>
>                 Key: JCS-16
>                 URL: https://issues.apache.org/jira/browse/JCS-16
>             Project: JCS
>          Issue Type: Bug
>          Components: Composite Cache
>    Affects Versions: jcs-1.3
>         Environment: Windows
>            Reporter: Peter Lawrey
>            Assignee: Aaron Smuts
>            Priority: Minor
>             Fix For: jcs-1.4-dev
>
>
> Using code based on JSCThrashTest ..
> jcs.default=
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.default.cacheattributes.MaxObjects=10000
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> If I add 10,000 elements the getListSize() return 9,998 elements.
> If I change the MaxObjects to 10002 and add 15 K elements the getListSize() 
> return 10,000 elements.
> Is there a good reason I need to add 2 to MaxObjects?
> I have scanned the cache and found there is actually 10000 elements when 
> MaxObject is set to 10002

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to