'Stores session information in the cache. Assumes that the name_id
is unique within the context of the Service Provider.
:param name_id: The subject identifier, a NameID instance
:param entity_id: The identifier of the entity_id/receiver of an
assertion
:param info: The session info, the assertion is part of this
:param not_on_or_after: A time after which the assertion is not valid.'

def set(self, name_id, entity_id, info, not_on_or_after=0):

    cni = code(name_id)
    if (cni not in self._db):
        self._db[cni] = {}
    self._db[cni][entity_id] = (not_on_or_after, info)
    if self._sync:
        try:
            self._db.sync()
        except AttributeError:
            pass
