def Put(self, key, obj):
    """Add the object to the cache."""
    # Remove the old entry if it is there.
    node = self._hash.pop(key, None)
    if node:
      self._age.Unlink(node)

    # Make a new node and insert it.
    node = Node(key=key, data=obj)
    self._hash[key] = node
    self._age.AppendNode(node)

    self.Expire()

    return key
def Put ( self , key , obj ) : node = self . _hash . pop ( key , None ) if node : self . _age . Unlink ( node ) node = Node ( key = key , data = obj ) self . _hash [ key ] = node self . _age . AppendNode ( node ) self . Expire ( ) return key
Add the object to the cache.