code: private void pruneIfNeeded(int neededSpace) {
          if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes) {
              return;
          }
  //        if (JusLog.DEBUG) {
  //            JusLog.v("Pruning old cache entries.");
  //        }
          //todo add queue markers
  
          long before = mTotalSize;
          int prunedFiles = 0;
          long startTime = System.nanoTime();
  
          Iterator<Map.Entry<String, CacheHeader>> iterator = mEntries.entrySet().iterator();
          while (iterator.hasNext()) {
              Map.Entry<String, CacheHeader> entry = iterator.next();
              CacheHeader e = entry.getValue();
              boolean deleted = getFileForKey(e.key).delete();
              if (deleted) {
                  mTotalSize -= e.size;
              } else {
                  //todo add queue markers
  //               JusLog.d("Could not delete cache entry for key=%s, filename=%s",
  //                       e.key, getFilenameForKey(e.key));
              }
              iterator.remove();
              prunedFiles++;
  
              if ((mTotalSize + neededSpace) < mMaxCacheSizeInBytes * HYSTERESIS_FACTOR) {
                  break;
              }
          }
  //todo add queue markers
  //        if (JusLog.DEBUG) {
  //            JusLog.v("pruned %d files, %d bytes, %d ms",
  //                    prunedFiles, (mTotalSize - before), System.nanoTime() - startTime);
  //        }
      }
docs: Prunes the cache to fit the amount of bytes specified.
  
  @param neededSpace The amount of bytes we are trying to fit into the cache.