discontinuedPackage keyscope_client has been discontinued.

KeyscopePool class

Manages a pool of KeyscopeClient connections with robust resource tracking.

This is the recommended class for high-concurrency applications as it avoids the overhead of creating new connections for every request.

v1.7.0 Features:

  • Smart Release: Automatically discards stateful (dirty) connections.
  • Idempotency: Safe to call release/discard multiple times.
  • Leak Prevention: Tracks all created connections to prevent leaks.

Constructors

KeyscopePool({required KeyscopeConnectionSettings connectionSettings, int maxConnections = 10})
Creates a new connection pool.

Properties

hashCode → int
The hash code for this object.
no setterinherited
idleConnectionCount → int
Returns the number of connections currently idle.
no setter
leasedConnectionCount → int
Returns the number of connections currently in use.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalConnectionCount → int
Returns the total number of connections managed by this pool.
no setter

Methods

acquire() → Future<KeyscopeClient>
Acquires a client connection from the pool.
close() → Future<void>
Closes all connections and the pool itself.
discard(KeyscopeClient client) → Future<void>
Explicitly discards a connection, removing it from the pool and closing it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release(KeyscopeClient client) → void
Releases a connection back to the pool. Automatically discards if the client is closed or stateful (Smart Release).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited