/* static */ PLDHashOperator
nsPreflightCache::RemoveExpiredEntries(const nsACString& aKey,
                                       nsAutoPtr<CacheEntry>& aValue,
                                       void* aUserData)
{
    TimeStamp* now = static_cast<TimeStamp*>(aUserData);

    aValue->PurgeExpired(*now);

    if (aValue->mHeaders.IsEmpty() &&
            aValue->mMethods.IsEmpty()) {
        // Expired, remove from the list as well as the hash table.
        aValue->removeFrom(sPreflightCache->mList);
        return PL_DHASH_REMOVE;
    }

    return PL_DHASH_NEXT;
}