def clean_object_caches(obj):
    """
    Clean all object caches on the given object.

    Args:
        obj (Object instace): An object whose caches to clean.

    Notes:
        This is only the contents cache these days.

    """
    global _TYPECLASSMODELS, _OBJECTMODELS
    if not _TYPECLASSMODELS:
        from evennia.typeclasses import models as _TYPECLASSMODELS

    if not obj:
        return
    # contents cache
    try:
        _SA(obj, "_contents_cache", None)
    except __HOLE__:
        pass

    # on-object property cache
    [_DA(obj, cname) for cname in viewkeys(obj.__dict__)
                     if cname.startswith("_cached_db_")]
    try:
        hashid = _GA(obj, "hashid")
        _TYPECLASSMODELS._ATTRIBUTE_CACHE[hashid] = {}
    except AttributeError:
        pass
dataset/ETHPy150Open evennia/evennia/evennia/utils/utils.py/clean_object_caches