Skip to content

Commit b174256

Browse files
sharetripiqbalJsIqbal
authored andcommitted
Understand Basic Sort
1 parent 0ba2b13 commit b174256

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,30 @@ then apply ->
412412
"bad",
413413
"good",
414414
"ok"
415-
]
415+
]
416+
```
417+
- `SORT books:likes BY books:*->year ` :
418+
* breakdown of the command:
419+
- first replace the * with the member from the sorted set : books:good
420+
- scan redis for the key books:good
421+
- if the key exists then find the value with the year: books:good has year 1950 in it.
422+
- create a volatile set with key value structure like:
423+
```bash
424+
good - 1950
425+
bad - 1920
426+
ok - 1960
427+
```
428+
- BY means sort the set by descending order like:
429+
```bash
430+
bad - 1920
431+
good - 1950
432+
ok - 1960
433+
```
434+
response from redis:
435+
```bash
436+
[
437+
"bad",
438+
"good",
439+
"ok"
440+
]
441+
```

0 commit comments

Comments
 (0)