redistimeseries-py icon indicating copy to clipboard operation
redistimeseries-py copied to clipboard

change output for mget to dict

Open AlKorochkin opened this issue 5 years ago • 0 comments

Hello,

Used RedisTimeSeries v1.2.2/redistimeseries-py v0.8.0

Now mget return list of dict objects like:

[
    {'TestKey-0': [{}, 1582184963941, 4.5]}, 
    {'TestKey-1': [{}, 1582184963960, 4.5]},
    ...n
]

Such a format does not allow direct access to elements by key. This makes iterate over the list and access the dictionary objects to get its key or value. With a large number of elements, this is expensive.

It may be worth changing the output format for mget to:

{
    'TestKey-0': ({}, 1582184963941, 4.5), 
    'TestKey-1': ({}, 1582184963960, 4.5),
    ...n
}

This will allow to get the dict values directly, without iterating through the list. It structure in theory can save some memory.

AlKorochkin avatar Feb 20 '20 10:02 AlKorochkin