Created
July 10, 2021 19:44
-
-
Save Chriz76/9260a4b11dae6eed77117a5bff2519ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<Category> ReadTopCategories(int offset, int countCategories) | |
{ | |
var cache = _muxer.GetDatabase(); | |
var res = cache.SortedSetRangeByRankWithScores("CategoriesByPostCount", offset, offset + countCategories -1, Order.Descending); | |
var ret = new List<Category>(); | |
foreach(var e in res) | |
{ | |
ret.Add(new Category { CategoryId = e.Element, PostCount = (long)e.Score }); | |
} | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment