public synchronized long clear(){
  long removedSize=0;
  while (true) {
    Map.Entry<Key,Value> entry=entries.pollFirstEntry();
    if (entry == null) {
      break;
    }
    Value value=entry.getValue();
    removedSize+=weighter.getSize(value);
    value.release();
  }
  entries.clear();
  return size.getAndAdd(-removedSize);
}

public synchronized long clear ( ) { long removedSize = 0 ; while ( true ) { Map . Entry < Key , Value > entry = entries . pollFirstEntry ( ) ; if ( entry == null ) { break ; } Value value = entry . getValue ( ) ; removedSize += weighter . getSize ( value ) ; value . release ( ) ; } entries . clear ( ) ; return size . getAndAdd ( - removedSize ) ; }
remove all the entries from the cache
