public void put ( Object key , Object value ) { if ( ( key == null ) || ( value == null ) ) return ; try { if ( maxSize > 0 ) { // when maxSize is changed, the setter will take care of filling // the // LRU list if ( cacheLineTable . containsKey ( key ) ) { keyLRUList . moveFirst ( key ) ; } else { keyLRUList . addFirst ( key ) ; } } if ( expireTime > 0 ) { cacheLineTable . put ( key , new CacheLine ( value , useSoftReference , System . currentTimeMillis ( ) ) ) ; } else { cacheLineTable . put ( key , new CacheLine ( value , useSoftReference ) ) ; } if ( maxSize > 0 && cacheLineTable . size ( ) > maxSize ) { Object lastKey = keyLRUList . getLast ( ) ; removeObject ( lastKey ) ; } } catch ( Exception e ) { Debug . logError ( e ) ; } finally { } Debug . logVerbose ( "[JdonFramework]cache now size = " + keyLRUList . size ( ) + " maxSize =" + maxSize + " this Cache id:" + this . hashCode ( ) , module ) ; }
Puts or loads the passed element into the cache