Returns the capacity of this Ringbuffer.

        :return: (long), the capacity of Ringbuffer.

def capacity(self):
        """
        Returns the capacity of this Ringbuffer.

        :return: (long), the capacity of Ringbuffer.
        """
        if not self._capacity:
            def cache_capacity(f):
                self._capacity = f.result()
                return f.result()

            return self._encode_invoke(ringbuffer_capacity_codec).continue_with(cache_capacity)
        return ImmediateFuture(self._capacity)