@Override public long clearOldEntries(long cacheExpirationMs){
  long oldestRemainingEntryAgeMs=0L;
synchronized (mLock) {
    try {
      long now=mClock.now();
      DiskStorage storage=mStorageSupplier.get();
      Collection<DiskStorage.Entry> allEntries=storage.getEntries();
      int itemsRemovedCount=0;
      long itemsRemovedSize=0L;
      for (      DiskStorage.Entry entry : allEntries) {
        long entryAgeMs=Math.max(1,Math.abs(now - entry.getTimestamp()));
        if (entryAgeMs >= cacheExpirationMs) {
          long entryRemovedSize=storage.remove(entry);
          if (entryRemovedSize > 0) {
            itemsRemovedCount++;
            itemsRemovedSize+=entryRemovedSize;
          }
        }
 else {
          oldestRemainingEntryAgeMs=Math.max(oldestRemainingEntryAgeMs,entryAgeMs);
        }
      }
      storage.purgeUnexpectedResources();
      if (itemsRemovedCount > 0) {
        maybeUpdateFileCacheSize();
        mCacheStats.increment(-itemsRemovedSize,-itemsRemovedCount);
        reportEviction(CacheEventListener.EvictionReason.CONTENT_STALE,itemsRemovedCount,itemsRemovedSize);
      }
    }
 catch (    IOException ioe) {
      mCacheErrorLogger.logError(CacheErrorLogger.CacheErrorCategory.EVICTION,TAG,"clearOldEntries: " + ioe.getMessage(),ioe);
    }
  }
  return oldestRemainingEntryAgeMs;
}

@ Override public long clearOldEntries ( long cacheExpirationMs ) { long oldestRemainingEntryAgeMs = 0L ; synchronized ( mLock ) { try { long now = mClock . now ( ) ; DiskStorage storage = mStorageSupplier . get ( ) ; Collection < DiskStorage . Entry > allEntries = storage . getEntries ( ) ; int itemsRemovedCount = 0 ; long itemsRemovedSize = 0L ; for ( DiskStorage . Entry entry : allEntries ) { long entryAgeMs = Math . max ( 1 , Math . abs ( now - entry . getTimestamp ( ) ) ) ; if ( entryAgeMs >= cacheExpirationMs ) { long entryRemovedSize = storage . remove ( entry ) ; if ( entryRemovedSize > 0 ) { itemsRemovedCount ++ ; itemsRemovedSize += entryRemovedSize ; } } else { oldestRemainingEntryAgeMs = Math . max ( oldestRemainingEntryAgeMs , entryAgeMs ) ; } } storage . purgeUnexpectedResources ( ) ; if ( itemsRemovedCount > 0 ) { maybeUpdateFileCacheSize ( ) ; mCacheStats . increment ( - itemsRemovedSize , - itemsRemovedCount ) ; reportEviction ( CacheEventListener . EvictionReason . CONTENT_STALE , itemsRemovedCount , itemsRemovedSize ) ; } } catch ( IOException ioe ) { mCacheErrorLogger . logError ( CacheErrorLogger . CacheErrorCategory . EVICTION , TAG , "clearOldEntries: " + ioe . getMessage ( ) , ioe ) ; } } return oldestRemainingEntryAgeMs ; }
deletes old cache files .
