Skip to content

[Task] Add connection pooling and isolated execution scopes support for PHP #265

Description

@jeremyprime

Description

Add client-instance pooling and isolated execution scopes, matching the existing implementation in Java, Python, Node, and Go (valkey-io/valkey-glide#6338). The pool/scope logic lives in the Rust core (glide-core/src/pool.rs, scope.rs) and FFI layer (ffi/src/pool_ffi.rs). This task covers the language binding, tests, and documentation.

Client-Instance Pool: Bounded pool of reusable connections with LIFO reuse, background warmup, connectivity probe on create, state reset on release (DISCARD + SELECT), and configurable acquire timeout.

Isolated Execution Scopes: Dedicated per-connection state for WATCH/MULTI/EXEC with cluster slot pinning, cross-slot rejection, compression/timeout inheritance from parent client, and zero-cost release when state is clean.

Checklist

  • Add ClientPool class with create/acquire/release/borrow/close/metrics API
  • Add PoolConfig class (max_size, min_idle, idle_timeout, request_timeout, acquire_timeout)
  • Add IsolatedScope class with command dispatch via FFI send_scope_command
  • Wire FFI calls to libglide_ffi (pool_create, try_acquire, acquire_blocking, release, destroy, scope_try_acquire, scope_execute, scope_release)
  • Add integration tests: pool lifecycle, borrow+commands, timeout, concurrent access, metrics
  • Add integration tests: scope WATCH/MULTI/EXEC, cross-slot rejection (cluster), state reset
  • Add documentation/examples

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions