class Lease

Properties

protected bool $finalized

Methods

__construct(ObjectPool $pool, object $object, Closure|null $releaseCallback = null)

Create a lease for one checked-out object.

object
get()

Get the borrowed object.

void
release()

Run reset behavior and return the object to the pool.

void
discard()

Destroy the borrowed object instead of returning it to the pool.

never
releaseAfterFailure(Throwable $failure)

Release the object while preserving failure precedence.

never
discardAfterFailure(Throwable $failure)

Discard the object while preserving failure precedence.

__destruct()

Finalize an abandoned lease without letting cleanup failures escape.

Details

at line 22
__construct(ObjectPool $pool, object $object, Closure|null $releaseCallback = null)

Create a lease for one checked-out object.

Parameters

ObjectPool $pool
object $object
Closure|null $releaseCallback

at line 32
object get()

Get the borrowed object.

Return Value

object

at line 44
void release()

Run reset behavior and return the object to the pool.

Return Value

void

at line 83
void discard()

Destroy the borrowed object instead of returning it to the pool.

Return Value

void

at line 96
never releaseAfterFailure(Throwable $failure)

Release the object while preserving failure precedence.

Parameters

Throwable $failure

Return Value

never

at line 112
never discardAfterFailure(Throwable $failure)

Discard the object while preserving failure precedence.

Parameters

Throwable $failure

Return Value

never

at line 128
__destruct()

Finalize an abandoned lease without letting cleanup failures escape.