class StreamingController::ConnectionPool

Overview

Limits the number of long-lived connections.

Limits the number of long-lived connections by maintaining a pool of connections. When the pool is full, adding a new connection closes the oldest connection.

A "connection" is any subclass of IO.

Defined in:

controllers/streaming.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(capacity) #

[View source]

Instance Method Detail

def capacity #

Returns the capacity of the pool.


[View source]
def includes?(connection) #

Returns true if the pool includes connection.


[View source]
def push(connection) #

Pushes connection into the pool.

If the pool is at capacity, the oldest connection is closed, removed from the pool, and returned.


[View source]
def size #

Returns the number of connections in the pool.


[View source]