'Cache a DNS entry.
@param query: a L{dns.Query} instance.
@param payload: a 3-tuple of lists of L{dns.RRHeader} records, the
matching result of the query (answers, authority and additional).
@param cacheTime: The time (seconds since epoch) at which the entry is
considered to have been added to the cache. If L{None} is given,
the current time is used.'

def cacheResult(self, query, payload, cacheTime=None):

    if (self.verbose > 1):
        log.msg(('Adding    %r    to    cache' % query))
    self.cache[query] = ((cacheTime or self._reactor.seconds()), payload)
    if (query in self.cancel):
        self.cancel[query].cancel()
    s = ((list(payload[0]) + list(payload[1])) + list(payload[2]))
    if s:
        m = s[0].ttl
        for r in s:
            m = min(m, r.ttl)
    else:
        m = 0
    self.cancel[query] = self._reactor.callLater(m, self.clearEntry, query)
