LazyStickyPool

class LazyStickyPool<A : Any>(size: Int, newInstance: () -> A)

A LazyStickyPool is a lazy pool of resources where a borrow may "stick" the borrowed instance to an object. Any subsequent borrows using the same object will return the same pooled instance.

Parameters

size

The size of the pool.

newInstance

The function to call to create a pooled resource.

Constructors

Link copied to clipboard
constructor(size: Int, newInstance: () -> A)

Functions

Link copied to clipboard
fun borrow(): <Error class: unknown class><Any, A>
fun borrow(stickTo: Any): A
Link copied to clipboard
fun close(): Iterable<A>
Link copied to clipboard
fun release(stickTo: Any, instance: A)
Link copied to clipboard
inline fun <R> run(stickToOrNull: Any? = null, withInstance: (A) -> R): R