def METHOD_NAME(cache):
    len_cache = len(cache)
    if len_cache >= SLOTS:
        nclean = NCLEAN + len_cache - SLOTS
        keys_to_delete = sorted(cache, key=lambda k: cache[k][0])[:nclean]
        for key in keys_to_delete:
            del cache[key]