An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 2.1% on proxy.golang.org
Top 0.7% dependent packages on proxy.golang.org
Top 0.2% dependent repos on proxy.golang.org
Top 3.9% forks on proxy.golang.org
Top 1.3% docker downloads on proxy.golang.org

proxy.golang.org : github.com/wangjia184/sortedset

Package sortedset provides the data-struct allows fast access the element in set by key or by score(order). It is inspired by Sorted Set from Redis. Every node in the set is associated with these properties. Each node in the set is associated with a key. While keys are unique, scores may be repeated. Nodes are taken in order (from low score to high score) instead of ordered afterwards. If scores are the same, the node is ordered by its key in lexicographic order. Each node in the set also can be accessed by rank, which represents the position in the sorted set. Sorted Set is implemented basing on skip list and hash map internally. With sorted sets you can add, remove, or update nodes in a very fast way (in a time proportional to the logarithm of the number of nodes). You can also get ranges by score or by rank (position) in a very fast way. Accessing the middle of a sorted set is also very fast, so you can use Sorted Sets as a smart list of non repeating nodes where you can quickly access everything you need: nodes in order, fast existence test, fast access to nodes in the middle! A typical use case of sorted set is a leader board in a massive online game, where every time a new score is submitted you update it using AddOrUpdate() method. You can easily take the top users using GetByRankRange() method, you can also, given an user id, return its rank in the listing using FindRank() method. Using FindRank() and GetByRankRange() together you can show users with a score similar to a given user. All very quickly. Examples

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/wangjia184/sortedset
License: BSD-2-Clause
Latest release: about 3 years ago
First release: almost 9 years ago
Namespace: github.com/wangjia184
Dependent packages: 35
Dependent repositories: 1,021
Stars: 130 on GitHub
Forks: 36 on GitHub
Docker dependents: 9
Docker downloads: 1,001
See more repository details: repos.ecosyste.ms
Last synced: 2 months ago

    Loading...
    Readme
    Loading...