private synchronized void trimToSize ( ) { if ( mSize > mCapacity ) { if ( SimpleDiskLruCache . DEBUG ) { CLog . d ( SimpleDiskLruCache . LOG_TAG , "should trim, current is: %s" , mSize ) ; } } while ( mSize > mCapacity ) { Map . Entry < String , CacheEntry > toEvict = mLruEntries . entrySet ( ) . iterator ( ) . next ( ) ; String key = toEvict . getKey ( ) ; CacheEntry cacheEntry = toEvict . getValue ( ) ; mLruEntries . remove ( key ) ; mSize -= cacheEntry . getSize ( ) ; addActionLog ( ACTION_PENDING_DELETE , cacheEntry ) ; if ( SimpleDiskLruCache . DEBUG ) { CLog . d ( SimpleDiskLruCache . LOG_TAG , "pending remove: %s, size: %s, after remove total: %s" , key , cacheEntry . getSize ( ) , mSize ) ; } } }
remove files from list delete files