core (memory/cache): common cache:

host has now a common_cache attribute for data which can be shared between profiles. client.cache is for private data
This commit is contained in:
Goffi 2018-03-02 17:40:09 +01:00
commit 7bc5b99ea1
2 changed files with 35 additions and 20 deletions

View file

@ -29,7 +29,8 @@ from sat.core import exceptions
from sat.core.log import getLogger
log = getLogger(__name__)
from sat.core.constants import Const as C
from sat.memory.memory import Memory
from sat.memory import memory
from sat.memory import cache
from sat.tools import trigger
from sat.tools import utils
from sat.tools.common import dynamic_import
@ -58,7 +59,7 @@ class SAT(service.Service):
self.plugins = {}
self.ns_map = {u'x-data': u'jabber:x:data'} # map for short name to whole namespace,
# extended by plugins with registerNamespace
self.memory = Memory(self)
self.memory = memory.Memory(self)
self.trigger = trigger.TriggerManager() # trigger are used to change SàT behaviour
bridge_name = self.memory.getConfig('', 'bridge', 'dbus')
@ -149,6 +150,7 @@ class SAT(service.Service):
def _postMemoryInit(self, ignore):
"""Method called after memory initialization is done"""
self.common_cache = cache.Cache(self, None)
log.info(_("Memory initialised"))
try:
self._import_plugins()

View file

@ -523,7 +523,7 @@ class SatXMPPClient(SatXMPPEntity, wokkel_client.XMPPClient):
# but we restrict to domish.Element to make trigger treatments easier
assert isinstance(obj, domish.Element)
# XXX: this trigger is the last one before sending stanza on wire
# is it is intended for things like end 2 end encryption.
# it is intended for things like end 2 end encryption.
# *DO NOT* cancel (i.e. return False) without very good reason
# (out of band transmission for instance).
# e2e should have a priority of 0 here, and out of band transmission