Skip to content

Instantly share code, notes, and snippets.

@Chriz76
Created July 10, 2021 19:44
Show Gist options
  • Save Chriz76/9260a4b11dae6eed77117a5bff2519ac to your computer and use it in GitHub Desktop.
Save Chriz76/9260a4b11dae6eed77117a5bff2519ac to your computer and use it in GitHub Desktop.
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