X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/43f30ac0f9bcc4a7afb06136a8dfe5b703be7935..12ebe2ac17a26ecf263f90b2acdf03db29b00223:/doc/Sets.html
diff --git a/doc/Sets.html b/doc/Sets.html
index db7e7f9d..19fe7f80 100644
--- a/doc/Sets.html
+++ b/doc/Sets.html
@@ -26,8 +26,7 @@
- #sidebar
SetCommandsSidebarRedis Sets are unordered collections of
Redis Strings. It's possible to add, remove, and test for existence of members in O(1).
Redis Sets have the desirable property of not allowing repeated members. Adding the same element multiple times will result in a set having a single copy of this element. Practically speaking this means that adding an members does not require a "check if exists then add" operation.
Commands operating on sets try to make a good use of the return value in order to signal the application about previous existence of members. For instance the
SADD command will return 1 if the element added was not already a member of the set, otherwise will return 0.
The max number of members in a set is 232-1 (4294967295, more than 4 billion of members per set).
Redis Sets support a wide range of operations, like union, intersection, difference. Intersection is optimized in order to perform the smallest number of lookups. For instance if you try to intersect a 10000 members set with a 2 members set Redis will iterate the 2 members set testing for members existence in the other set, performing 2 lookups instead of 10000.
Redis Sets are implemented using hash tables, so adding, removing and testing for members is O(1) in the average. The hash table will automatically resize when new elements are added or removed into a Set.
The hash table resizing is a blocking operation performed synchronously so working with huge sets (consisting of many millions of elements) care should be taken when mass-inserting a very big amount of elements in a Set while other clients are querying Redis at high speed.
It is possible that in the near future Redis will switch to skip lists (already used in sorted sets) in order to avoid such a problem.
-
+ #sidebar
SetCommandsSidebarRedis Sets are unordered collections of
Redis Strings. It's possible to add, remove, and test for existence of members in O(1).
Redis Sets have the desirable property of not allowing repeated members. Adding the same element multiple times will result in a set having a single copy of this element. Practically speaking this means that adding an members does not require a "check if exists then add" operation.
Commands operating on sets try to make a good use of the return value in order to signal the application about previous existence of members. For instance the
SADD command will return 1 if the element added was not already a member of the set, otherwise will return 0.
The max number of members in a set is 232-1 (4294967295, more than 4 billion of members per set).
Redis Sets support a wide range of operations, like union, intersection, difference. Intersection is optimized in order to perform the smallest number of lookups. For instance if you try to intersect a 10000 members set with a 2 members set Redis will iterate the 2 members set testing for members existence in the other set, performing 2 lookups instead of 10000.
Redis Sets are implemented using hash tables, so adding, removing and testing for members is O(1) in the average. The hash table will automatically resize when new elements are added or removed into a Set.
The hash table resizing is a blocking operation performed synchronously so working with huge sets (consisting of many millions of elements) care should be taken when mass-inserting a very big amount of elements in a Set while other clients are querying Redis at high speed.
It is possible that in the near future Redis will switch to skip lists (already used in sorted sets) in order to avoid such a problem.