public async Task RangeByScore() { var set = new RedisSortedSet <string>(GlobalSettings.Default, "set"); await set.Delete(); await set.Add("a", 10); await set.Add("b", 100); await set.Add("c", 1000); await set.Add("d", 10000); await set.Add("e", 100000); await set.Add("f", 1000000); (await set.RangeByScore(100, 10000, exclude: Exclude.None)).Is("b", "c", "d"); (await set.RangeByScore(100, 10000, exclude: Exclude.Start)).Is("c", "d"); (await set.RangeByScore(100, 10000, exclude: Exclude.Stop)).Is("b", "c"); (await set.RangeByScore(100, 10000, exclude: Exclude.Both)).Is("c"); (await set.RangeByScore(100, 10000, exclude: Exclude.None, order: Order.Descending)).Is("d", "c", "b"); var hoge = await set.RangeByScore(100, 10000, exclude : Exclude.Start, order : Order.Descending); (await set.RangeByScore(100, 10000, exclude: Exclude.Start, order: Order.Descending)).Is("d", "c"); (await set.RangeByScore(100, 10000, exclude: Exclude.Stop, order: Order.Descending)).Is("c", "b"); (await set.RangeByScore(100, 10000, skip: 1)).Is("c", "d"); (await set.RangeByScore(100, 10000, skip: 2)).Is("d"); (await set.RangeByScore(100, 10000, take: 2)).Is("b", "c"); (await set.RangeByScore(100, 10000, skip: 1, take: 1)).Is("c"); var r = await set.RangeByScoreWithScores(100, 10000); r.Select(x => x.Value).Is("b", "c", "d"); r.Select(x => x.Score).Is(100, 1000, 10000); // length (await set.Length()).Is(6); (await set.Length(100, 10000)).Is(3); (await set.Length(100, 10000, Exclude.Both)).Is(1); }
public async Task RangeByScore() { var set = new RedisSortedSet<string>(GlobalSettings.Default, "set"); await set.Delete(); await set.Add("a", 10); await set.Add("b", 100); await set.Add("c", 1000); await set.Add("d", 10000); await set.Add("e", 100000); await set.Add("f", 1000000); (await set.RangeByScore(100, 10000, exclude: Exclude.None)).Is("b", "c", "d"); (await set.RangeByScore(100, 10000, exclude: Exclude.Start)).Is("c", "d"); (await set.RangeByScore(100, 10000, exclude: Exclude.Stop)).Is("b", "c"); (await set.RangeByScore(100, 10000, exclude: Exclude.Both)).Is("c"); (await set.RangeByScore(100, 10000, exclude: Exclude.None, order: Order.Descending)).Is("d", "c", "b"); var hoge = await set.RangeByScore(100, 10000, exclude: Exclude.Start, order: Order.Descending); (await set.RangeByScore(100, 10000, exclude: Exclude.Start, order: Order.Descending)).Is("d", "c"); (await set.RangeByScore(100, 10000, exclude: Exclude.Stop, order: Order.Descending)).Is("c", "b"); (await set.RangeByScore(100, 10000, skip: 1)).Is("c", "d"); (await set.RangeByScore(100, 10000, skip: 2)).Is("d"); (await set.RangeByScore(100, 10000, take: 2)).Is("b", "c"); (await set.RangeByScore(100, 10000, skip: 1, take: 1)).Is("c"); var r = await set.RangeByScoreWithScores(100, 10000); r.Select(x => x.Value).Is("b", "c", "d"); r.Select(x => x.Score).Is(100, 1000, 10000); // length (await set.Length()).Is(6); (await set.Length(100, 10000)).Is(3); (await set.Length(100, 10000, Exclude.Both)).Is(1); }