def METHOD_NAME(cache):
    cache.purge_count = 0
    purge = cache.purge_expired_entries
    def purge_then_increment():
        purge()
        cache.purge_count += 1
        purged_event.set()
    cache.purge_expired_entries = purge_then_increment
    return cache