struct Novika::ObjectPool(T)

Overview

A naïve object pool, inspired by:

https://gist.github.com/floere/3121579

Defined in:

novika/object_pool.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(create : -> T, clear : T -> T) #

Instance Method Detail

def acquire : T #

Returns a free/new instance of the object.


def release(obj : T) #

Clears the given instance of the object, and releases it so that it can be acquired by someone else.