Пример #1
0
    def _set_cache(self, cache_type, _):
        # For volatile sessions we use a timed cache (which expires after a
        # short time).
        if self.session.volatile:
            cache_type = "timed"

        self.session.cache = cache.Factory(self.session, cache_type)
        return cache_type
Пример #2
0
    def Reset(self):
        self.context_cache = {}
        self.profile_cache = {}
        self.kernel_address_space = None

        # For volatile sessions we use a timed cache (which expires after a
        # short time).
        cache_type = self.GetParameter("cache", "memory")
        if self.volatile:
            cache_type = "timed"

        self.cache = cache.Factory(self, cache_type)
        if self.physical_address_space:
            self.physical_address_space.ConfigureSession(self)
Пример #3
0
    def __init__(self, **kwargs):
        self.progress = ProgressDispatcher()

        # Cache the profiles we get from LoadProfile() below.
        self.profile_cache = {}

        # A container for active plugins. This is done so that the interactive
        # console can see which plugins are active by simply command completing
        # on this object.
        self.plugins = PluginContainer(self)

        # When the session switches process context we store various things in
        # this cache, so we can restore the context quickly. The cache is
        # indexed by the current process_context which can be found from
        # session.GetParameter("process_context").
        self.context_cache = {}
        self._repository_managers = []

        # Store user configurable attributes here. These will be read/written to
        # the configuration file.
        self.state = Configuration(session=self)
        self.cache = cache.Factory(self, "memory")
        with self.state:
            for k, v in kwargs.items():
                self.state.Set(k, v)

        # We use this logger if provided.
        self.logger = kwargs.pop("logger", None)
        self._logger = None

        # Make this session id unique.
        Session.session_id += 1

        # At the start we haven't run any plugin.
        self.last = None

        # Locks for running hooks.
        self._hook_locks = set()

        # Hooks that will be called when we get flushed.
        self._flush_hooks = []

        self.renderers = []
Пример #4
0
    def Reset(self):
        self.context_cache = {}
        self.profile_cache = {}
        self.kernel_address_space = None

        # For volatile sessions we use a timed cache (which expires after a
        # short time).
        cache_type = self.GetParameter("cache", "memory")
        if self.volatile:
            cache_type = "timed"

        if self.cache:
            self.remove_flush_hook(self.cache)

        self.cache = cache.Factory(self, cache_type)
        if self.physical_address_space:
            self.physical_address_space.ConfigureSession(self)

        # Fix up the completer. This is sometimes required after the debugger
        # steals readline focus. Typing session.Reset() fixes things again.
        self.shell.init_completer()