log.debug( "Keys size: " + size );
}
Serializable key;
ICacheElement cacheElement;
IElementAttributes attributes;
int spoolCount = 0;
for ( int i = 0; i < size; i++ )
{
key = (Serializable) keys[i];
cacheElement = cache.getQuiet( key );
if ( cacheElement == null )
{
continue;
}
attributes = cacheElement.getElementAttributes();
boolean remove = false;
long now = System.currentTimeMillis();
// Useful, but overkill even for DEBUG since it is written for
// every element in memory
//
// if ( log.isDebugEnabled() )
// {
// log.debug( "IsEternal: " + attributes.getIsEternal() );
// log.debug( "MaxLifeSeconds: "
// + attributes.getMaxLifeSeconds() );
// log.debug( "CreateTime:" + attributes.getCreateTime() );
// }
// If the element is not eternal, check if it should be
// removed and remove it if so.
if ( !cacheElement.getElementAttributes().getIsEternal() )
{
remove = checkForRemoval( cacheElement, now );
if ( remove )
{
cache.remove( cacheElement.getKey() );
}
}
// If the item is not removed, check is it has been idle
// long enough to be spooled.
if ( !remove && ( maxMemoryIdleTime != -1 ) )
{
if ( !spoolLimit || ( spoolCount < this.maxSpoolPerRun ) )
{
final long lastAccessTime = attributes.getLastAccessTime();
if ( lastAccessTime + maxMemoryIdleTime < now )
{
if ( log.isDebugEnabled() )
{