Moved get_evennia_pids into src.utils.utils for more general access.
This commit is contained in:
parent
2a7c45d6e8
commit
033344ad2c
5 changed files with 36 additions and 49 deletions
|
|
@ -3,31 +3,28 @@ Central caching module.
|
|||
|
||||
"""
|
||||
|
||||
import os, threading
|
||||
from collections import defaultdict
|
||||
from django.dispatch import Signal
|
||||
from django.core.cache import get_cache
|
||||
#from django.db.models.signals import pre_save, pre_delete, post_init
|
||||
from src.server.models import ServerConfig
|
||||
from src.utils.utils import uses_database, to_str
|
||||
from src.utils.utils import uses_database, to_str, get_evennia_pids
|
||||
|
||||
_GA = object.__getattribute__
|
||||
_SA = object.__setattr__
|
||||
_DA = object.__delattr__
|
||||
|
||||
_IS_SUBPROCESS = os.getpid() in get_evennia_pids()
|
||||
_IS_MAIN_THREAD = threading.currentThread().getName() == "MainThread"
|
||||
|
||||
#
|
||||
# Open handles to the caches
|
||||
# Set up the cache stores
|
||||
#
|
||||
|
||||
#_FIELD_CACHE = get_cache("field_cache")
|
||||
_FIELD_CACHE = {}
|
||||
_ATTR_CACHE = {}
|
||||
#_ATTR_CACHE = get_cache("attr_cache")
|
||||
#_PROP_CACHE = get_cache("prop_cache")
|
||||
_PROP_CACHE = defaultdict(dict)
|
||||
|
||||
# make sure caches are empty at startup
|
||||
#_FIELD_CACHE.clear()
|
||||
_ATTR_CACHE.clear()
|
||||
#_PROP_CACHE.clear()
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Cache key hash generation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue