Removed unnecessary caching operation of dbid.

This commit is contained in:
Griatch 2015-01-28 18:49:04 +01:00
parent bbb99a9c28
commit f505e4959f

View file

@ -38,7 +38,6 @@ from evennia.typeclasses.tags import Tag, TagHandler, AliasHandler, PermissionHa
from evennia.utils.idmapper.models import SharedMemoryModel from evennia.utils.idmapper.models import SharedMemoryModel
from evennia.utils.idmapper.base import SharedMemoryModelBase from evennia.utils.idmapper.base import SharedMemoryModelBase
from evennia.server.caches import get_prop_cache, set_prop_cache
#from evennia.server.caches import set_attr_cache #from evennia.server.caches import set_attr_cache
#from evennia.server.caches import call_ndb_hooks #from evennia.server.caches import call_ndb_hooks
@ -269,11 +268,7 @@ class TypedObject(SharedMemoryModel):
Caches and returns the unique id of the object. Caches and returns the unique id of the object.
Use this instead of self.id, which is not cached. Use this instead of self.id, which is not cached.
""" """
dbid = get_prop_cache(self, "_dbid") return self.id
if not dbid:
dbid = self.id
set_prop_cache(self, "_dbid", dbid)
return dbid
def __dbid_set(self, value): def __dbid_set(self, value):
raise Exception("dbid cannot be set!") raise Exception("dbid cannot be set!")
@ -287,7 +282,7 @@ class TypedObject(SharedMemoryModel):
""" """
Returns the object's dbref on the form #NN. Returns the object's dbref on the form #NN.
""" """
return "#%s" % self.dbid return "#%s" % self.id
def __dbref_set(self): def __dbref_set(self):
raise Exception("dbref cannot be set!") raise Exception("dbref cannot be set!")