Code example for ConcurrentLinkedQueue

Methods: addremove

   *      of the same 'key' in lruKeys, but this is handled by the loop in trimCache(),  
   *      where an attempt to remove the same key twice is a no-op. 
   * </ol> 
  private void markRecentlyUsed(TFCKey key) {
  private synchronized void trimCache() { 
    // loop until cache is of desired  size. 
    while (cache.size()>maxCacheSize ) { 
      TFCKey key = lruKeys.poll();
      if (key==null) { //defensive
        // it is defensive since lruKeys presumably covers the cache keys  
        key = cache.keys().nextElement(); 
      // remove this element. Note that an attempt to remove with the same key again is a no-op, 
      // which gracefully handles the possible race in markRecentlyUsed().