I was trying to come up with a use case for this. Reversing an array
is optimized in most (all?) languages, and besides that, allowing for
this kind of behavior may hide some bugs on the app side. A use case I
can imagine would be to keep a list of users and be able to grab the
last N registered users in one operation. Again, this is something I
can accomplish on the app side (I would add a method last(key, n) in
my app and encapsulate the lrange + reverse logic).
In any case, I don't strongly oppose this addition, especially if you
guys find a use case for it.
--
Michel
> In any case, I don't strongly oppose this addition, especially if you
> guys find a use case for it.
Hello Michel,
It's a bit hard to find a legitimate use case for me, because it is
pretty simple to add the elements in the order you want to take them
back. And is not common that you need the two different sorting when
using LRANGE. It makes sense to have the latest comments, but the
first N-comments? And anyway since LRANGE is often used for
pagination, and usually there are few items per page, to just reverse
the taken range in the application side is trivial.
That said it's simple to implement. What about that: to implement this
only if we see a couple of requests of this feature that makes sense
(with explained use case) on the list.
Yes, that would be perfect :-)
--
Michel