[13.x] Pipeline tagged Redis cache reads

Merged
0X
7d ago
+241-2

RedisTaggedCache::many() currently issues a separate GET for each key. This also affects tagged flexible() reads, which retrieve the cached value and its creation timestamp separately.

This pipelines the individual GETs on standalone Predis and PhpRedis connections. Each command still addresses a single key, so the batch works when a single endpoint enforces Redis Cluster slots. Cluster-aware connections keep their existing per-key reads.

Validation

  • Tested against Redis 8.0.6 with Predis 3.7.0 and PhpRedis 6.2.0. A TCP probe confirmed the round-trip counts for both clients. Median latency comes from five runs of 1,000 warm operations per scenario over loopback.

    WorkloadRound tripsPredis p50PhpRedis p50
    Eight-key tagged many()8 → 1273 → 82 µs200 → 52 µs
    Warm tagged flexible()2 → 163 → 45 µs56 → 31 µs
    Eight-key many() plus nine warm flexible() calls26 → 10876 → 529 µs817 → 373 µs
  • Both clients returned the expected values for same-slot and cross-slot reads on a three-node Redis Cluster and through a standalone connection to a single node enforcing cluster slots. Warm flexible() entries did not invoke the refresh callback.

  • Focused cache tests passed with 19 tests and 48 assertions. Pint and git diff --check passed.