Cacheman comparison best
The commands are also allowed to return zero elements, and the client should not consider the iteration complete as long as the returned cursor is not zero. SCAN family functions do not guarantee that the number of elements returned per call are in a given range. *Number of elements returned at every SCAN call
#Cacheman comparison best full#
![cacheman comparison best cacheman comparison best](https://sharewareonsale.com/wp-content/uploads/2015/03/why_is_my_computer_so_slow.png)
The SCAN command, and the other commands in the SCAN family, are able to provide to the user a set of guarantees associated to full iterations. Starting an iteration with a cursor value of 0, and calling SCAN until the returned cursor is 0 again is called a full iteration. Since in the second call the returned cursor is 0, the server signaled to the caller that the iteration finished, and the collection was completely explored. The second call uses the cursor returned by the previous call as the first element of the reply, that is, 17.Īs you can see the SCAN return value is an array of two values: the first value is the new cursor to use in the next call, the second value is an array of elements. In the example above, the first call uses zero as a cursor, to start the iteration. The following is an example of SCAN iteration: redis 127.0.0.1:6379> scan 0 This means that at every call of the command, the server returns an updated cursor that the user needs to use as the cursor argument in the next call.Īn iteration starts when the cursor is set to 0, and terminates when the cursor returned by the server is 0. The SCAN command does not need any key name argument as it iterates keys in the current database, so the iterated object is the database itself.
![cacheman comparison best cacheman comparison best](https://i1.rgstatic.net/publication/221595826_The_Output_of_a_Cache_under_the_Independent_Reference_Model-Where_Did_the_Locality_of_Reference_Go/links/0046351bf3465aae99000000/largepreview.png)
However an obvious difference is that in the case of SSCAN, HSCAN and ZSCAN the first argument is the name of the key holding the Set, Hash or Sorted Set value. Note that SCAN, SSCAN, HSCAN and ZSCAN all work very similarly, so this documentation covers all the four commands. However while blocking commands like SMEMBERS are able to provide all the elements that are part of a Set in a given moment, The SCAN family of commands only offer limited guarantees about the returned elements since the collection that we incrementally iterate can change during the iteration process.
![cacheman comparison best cacheman comparison best](https://img.yumpu.com/21464988/1/500x640/tweaking-optimizing-windowspdf-gegeek.jpg)
Since these commands allow for incremental iteration, returning only a small number of elements per call, they can be used in production without the downside of commands like KEYS or SMEMBERS that may block the server for a long time (even several seconds) when called against big collections of keys or elements.