예제 #1
0
    def cache_result(self, fprint, expires, req, cmd_obj, result_obj):
        with self.lock:
            # Make a snapshot of the session, as it provides context
            snapshot = Session.Snapshot(cmd_obj.session, ui=False)
            snapshot.ui = cmd_obj.session.ui
            cmd_obj.session = result_obj.session = snapshot

            # Note: We cache this even if the requirements are "dirty",
            #       as mere presence in the cache makes this a candidate
            #       for refreshing.
            self.cache[str(fprint)] = [expires, req, cmd_obj, result_obj]
            self.debug('Cached %s, req=%s' % (fprint, req))
예제 #2
0
    def cache_result(self, fprint, expires, req, cmd_obj, result_obj):
        with self.lock:
            # Make a snapshot of the session, as it provides context
            ss = Session.Snapshot(cmd_obj.session, ui=False)
            ss.ui = BackgroundInteraction(cmd_obj.session.config,
                                          log_parent=cmd_obj.session.ui)

            # Note: We cache this even if the requirements are "dirty",
            #       as mere presence in the cache makes this a candidate
            #       for refreshing.
            self.cache[str(fprint)] = [expires, req, ss, cmd_obj, result_obj,
                                       time.time()]
            self.debug('Cached %s, req=%s' % (fprint, sorted(list(req))))