Package io.ktor.utils.io.pool

Types

DefaultPool

abstract expect class DefaultPool<T : Any> : ObjectPool<T>

Default object pool implementation.

NoPoolImpl

abstract class NoPoolImpl<T : Any> : ObjectPool<T>

A pool implementation of zero capacity that always creates new instances

ObjectPool

interface ObjectPool<T : Any> : Closeable

SingleInstancePool

abstract class SingleInstancePool<T : Any> : ObjectPool<T>

A pool that produces at most one instance

Functions

useBorrowed

fun <T : Any, R> ObjectPool<T>.useBorrowed(
    block: (T) -> R
): R

Borrows and instance of T from the pool, invokes block with it and finally recycles it

useInstance

fun <T : Any, R> ObjectPool<T>.useInstance(
    block: (T) -> R
): R

Borrows and instance of T from the pool, invokes block with it and finally recycles it