def change_entry_id()

in kinto-remote-settings/src/kinto_remote_settings/changes/utils.py [0:0]


def change_entry_id(request, http_host, bucket_id, collection_id):
    """Generates a deterministic UUID based on input parameters
    and keeps it in cache.

    :rtype: str
    """
    global _CHANGES_ENTRIES_ID_CACHE

    cache_key = (http_host, bucket_id, collection_id)
    if cache_key not in _CHANGES_ENTRIES_ID_CACHE:
        collection_uri = core_utils.instance_uri(
            request, "collection", bucket_id=bucket_id, id=collection_id
        )
        uniqueid = http_host + collection_uri
        identifier = hashlib.md5(uniqueid.encode("utf-8")).hexdigest()
        entry_id = str(UUID(identifier))
        _CHANGES_ENTRIES_ID_CACHE[cache_key] = entry_id
    return _CHANGES_ENTRIES_ID_CACHE[cache_key]