Open GoogleCodeExporter opened 9 years ago
First of all, the Redis "transaction" mechanism is simple because we only want
it to execute multiple commands atomically. It sure would be possible to
implement some kind of rollback, but this comes at a huge performance penalty,
which is exactly why this is *not* supported.
The idea of a plugin system was proposed earlier this year and led to some
discussion that you can read here:
http://groups.google.com/group/redis-db/browse_thread/thread/923504bf13eec521/dd
2e82275a30ac3a
Can you elaborate on why you think that "data structures support" is limited?
Original comment by pcnoordh...@gmail.com
on 18 Aug 2010 at 10:42
pcnoordhuis, thanks for your comment. I have read the discussion on Google
groups.
Redis supports some basic data structures. But in some situations, we need
complex data structure server. For example, we have a user queue, push user id
in, and pop from queue head. User id should not be duplicated in the queue.
Currently, we write our own data structure server combined set and list. Find
in the set, then push to the queue if not found. We cannot use redis set and
list due to concurrent access issue.
If Redis supports plugins, or script, this could be easy to solve. But script
cannot handle more complex data structures.
Original comment by everwa...@gmail.com
on 18 Aug 2010 at 1:44
Couldn't a single, sorted set be used in this instance? Score would be a
timestamp; multi zrem zadd to "push", and multi zrange zremrangebyrank to
pop...
Original comment by matthewr...@comcast.net
on 21 Aug 2010 at 3:05
Thanks for your comments. I did not make clear. We have operations to move user
in the queue, such as move forward/backward, move to head/tail. I have read the
redis command reference carefully. It seems not able to do such operations
atomically.
Original comment by everwa...@gmail.com
on 25 Aug 2010 at 7:01
Performing those operations on lists is slow, generally O(n) where n is the
length of the list (or really, the position in the list that your item is).
You can use a zset to offer O(log(n)) performance for all of your operations,
but you need to implement a lock (which can be done in Redis) to make it work
correctly. Ask on the mailing list about how you would go about implementing
your operations on a zset if you aren't able to figure it out.
Original comment by josiah.c...@gmail.com
on 25 Aug 2010 at 7:31
Original issue reported on code.google.com by
everwa...@gmail.com
on 18 Aug 2010 at 3:06