snehac-miner / redis

Automatically exported from code.google.com/p/redis
0 stars 0 forks source link

Feature wished : lset, when 'out of range' occurs, creates the missing elements #47

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Thanks for the good job on Redis.

It is very useful if the lset behaviour change a little bit, as followings:

Say, i lset somekey 8 somevalue,
Now, if the key has less than 8 elements, it returns 'out of range'.

Suggestion: add an option: when this error occurs, creates the missing
element(s) with a empty string.

For example:
currently, there is 3 elements in 'somekey', so Redis create, atomically,
the 4th to 7th elements with empty string, and the 8th element with
'somevalue'.

Possible Usage:
it seems like a row of data, 'somekey' is the primary key, the elements are
the fields. Without the suggested option, i find it hard to fill up the
list in order by rpush one by one.
With the suggest option, i can freely assign and/or get data to/from each
field.

Sorry, i couldn't find anywhere to post the feature wished. if any, pls
tell me.

Original issue reported on code.google.com by laugeenk...@gmail.com on 6 Jul 2009 at 6:52

GoogleCodeExporter commented 8 years ago
this will not be done not because is not useful indeed, but because without 
locking
it's truly hard to manage a data structure that is set by index.

Original comment by anti...@gmail.com on 23 Oct 2009 at 12:33