Return the size of the queue for a given key and resource type.
        If the key is not in the cache, this will raise a KeyError.

def size(self, key, resource_type):
        """
        Return the size of the queue for a given key and resource type.
        If the key is not in the cache, this will raise a KeyError.
        """
        with self._objects_queue_lock:
            return len(self._objects_queue[key].get(resource_type, []))