private CacheElement updateInCache ( CacheElement elem ) { if ( shadowCache . firstKey ( ) == elem ) return elem ; elem . updateAccessed ( ) ; CacheElement prev = shadowCache . put ( elem , elem ) ; // faster if we could just insert at the top of the list. maybe we need to use LinkedList ? if ( prev != null && ( elem != prev ) ) { CacheElementComparator cc = new CacheElementComparator ( ) ; System . out . printf ( "elem != prev compare=%d%n" , cc . compare ( elem , prev ) ) ; System . out . printf ( "hash elem =%d prev=%d%n" , elem . hashCode ( ) , prev . hashCode ( ) ) ; } return elem ; }
get CacheElement specified by hashKey . If found update lastUsed in shadowCache .