Skip to content

[NFR]: Use mGet method when fetching multiple keys from Redis #16689

@RayHughes

Description

@RayHughes

Is your feature request related to a problem? Please describe.
The current implementation of getMultiple on Phalcon's Redis Cache Adapter is using a loop to fetch keys individually. This makes multiple requests to the Redis server and decreases application performance by increasing latency to the Redis Server.

  • PHP

https://github.com/phalcon/phalcon/blob/86e136b75c022b6f86c394b0bd4a0d4a76cccab8/src/Cache/AbstractCache.php#L181

  • Zephir

protected function doGetMultiple(var keys, var defaultValue = null) -> array

Describe the solution you'd like
Remove the loop logic for getMultiple and use PhpRedis's mGet method.

https://github.com/phpredis/phpredis?tab=readme-ov-file#mget

Describe alternatives you've considered
N/A

Additional context
We store realtime pricing data in Redis with a sub 3 second TTL as the data is updated very frequently. To reduce complexity, the dataset is stored using distributed keys based on category / market. A simple request can fetch upwards of 200 individual items from Redis.

Using Phalcon implementation, reading is delayed by increased latency. Using PhpRedis mGet performance is comparable to a single fetch.

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasenew feature requestPlanned Feature or New Feature Request

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions