def set_stream(cache, user_id, stream):
    """
    Overwrite stack in the cache.

    :param cache: werkzeug BasicCache-liek object
    :param user_id: id of user, used as key in cache
    :param stream: value to initialize new stack with

    :return: None
    """
    if stream:
        return cache.set(user_id, [stream])
