<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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, []))