Remove unused utils.clean_object_caches func

Sounds like this used to have a purpose but no longer does.
This commit is contained in:
Greg Taylor 2019-09-14 22:41:52 -07:00
parent 41622d4527
commit 3fb23f4c70

View file

@ -6,8 +6,6 @@ They provide some useful string and conversion methods that might
be of use when designing your own game. be of use when designing your own game.
""" """
from future.utils import viewkeys, raise_
import os import os
import sys import sys
import imp import imp
@ -1052,45 +1050,6 @@ def delay(timedelay, callback, *args, **kwargs):
return _TASK_HANDLER.add(timedelay, callback, *args, **kwargs) return _TASK_HANDLER.add(timedelay, callback, *args, **kwargs)
_TYPECLASSMODELS = None
_OBJECTMODELS = None
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 AttributeError:
# if the cache cannot be reached, move on anyway
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:
# skip caching
pass
_PPOOL = None _PPOOL = None
_PCMD = None _PCMD = None
_PROC_ERR = "A process has ended with a probable error condition: process ended by signal 9." _PROC_ERR = "A process has ended with a probable error condition: process ended by signal 9."