'Associate key and value in the cache.
@param key: the key
@type key: (dns.name.Name, int, int) tuple whose values are the
query name, rdtype, and rdclass.
@param value: The answer being cached
@type value: dns.resolver.Answer object'

def put(self, key, value):

    try:
        self.lock.acquire()
        node = self.data.get(key)
        if (node is not None):
            node.unlink()
            del self.data[node.key]
        while (len(self.data) >= self.max_size):
            node = self.sentinel.prev
            node.unlink()
            del self.data[node.key]
        node = LRUCacheNode(key, value)
        node.link_after(self.sentinel)
        self.data[key] = node
    finally:
        self.lock.release()
