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.
https://github.com/phalcon/phalcon/blob/86e136b75c022b6f86c394b0bd4a0d4a76cccab8/src/Cache/AbstractCache.php#L181
|
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.
Is your feature request related to a problem? Please describe.
The current implementation of
getMultipleon 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.https://github.com/phalcon/phalcon/blob/86e136b75c022b6f86c394b0bd4a0d4a76cccab8/src/Cache/AbstractCache.php#L181
cphalcon/phalcon/Cache/AbstractCache.zep
Line 202 in 83677f1
Describe the solution you'd like
Remove the loop logic for
getMultipleand use PhpRedis'smGetmethod.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
mGetperformance is comparable to a single fetch.