'Add an item with a particular to the cache.
>>> tracker = Tracking()
>>> tracker.add(\'log_perplexity\', 55.6)
>>> tracker.cache[\'log_perplexity\']
[55.6]
>>> tracker.add(\'log_perplexity\', 55.2)
>>> tracker.add(\'loss\', -12.1)
>>> tracker.cache[\'log_perplexity\']
[55.6, 55.2]
>>> tracker.cache[\'loss\']
[-12.1]'

def add(self, key, item):

    if (key not in self.cache):
        self.cache[key] = []
    self.cache[key].append(item)
    if (len(self.cache[key]) > self.n):
        self.cache[key] = self.cache[key][:self.n]
