def flush(self):
        """Flushes this instance's cache.

        The driver of this instance should call this method every
        `flush_interval`.

        Returns:
          list['ServicecontrolServicesAllocateQuotaRequest']: corresponding
          to AllocateQuotaRequests that were pending

        """
        if self._cache is None:
            return []
        with self._cache as c, self._out as out:
            c.expire()
            now = self._timer()
            for item in c.values():
                if (not self._in_flush_all) and (not self._should_expire(item)):
                    if (not item.is_in_flight) and item._op_aggregator is not None:
                        item.is_in_flight = True
                        item.last_refresh_timestamp = now
                        out.append(item.extract_request())  # pylint: disable=no-member
            flushed_items = list(out)
            out.clear()  # pylint: disable=no-member
            for req in flushed_items:
                assert isinstance(req, sc_messages.ServicecontrolServicesAllocateQuotaRequest)
            return flushed_items