'Add session to handler.
Args:
session (Session or int): Session or session id to add.
Notes:
We will only add a session/sessid if this actually also exists
in the the core sessionhandler.'

def add(self, session):

    global _SESSIONS
    if (not _SESSIONS):
        from evennia.server.sessionhandler import SESSIONS as _SESSIONS
    try:
        sessid = session.sessid
    except AttributeError:
        sessid = session
    sessid_cache = self._sessid_cache
    if ((sessid in _SESSIONS) and (sessid not in sessid_cache)):
        if (len(sessid_cache) >= _SESSID_MAX):
            return
        sessid_cache.append(sessid)
        self.obj.db_sessid = ','.join((str(val) for val in sessid_cache))
        self.obj.save(update_fields=['db_sessid'])
