Return whether a counter_id is present for a given instance key.
        If the key is not in the cache, raises a KeyError.

def contains(self, key, counter_id):
        """
        Return whether a counter_id is present for a given instance key.
        If the key is not in the cache, raises a KeyError.
        """
        with self._lock:
            return counter_id in self._metadata[key]