Closed paulodiovani closed 5 years ago
I claim this! I am going to add Redis
+1 for redis :D
https://github.com/arabyalhomsi/hacktoberrank/commit/23fdbba93d039569775be29f90699642d60c8575 This branch is not finsihed yet. I wanted to ask you about which way is the best to store our values in redis. Here, I just store every entry (user and his pull requests) into a redis list. The key of the list is the username and the items are their PRs. It works perfectly, however, the order is not maintained this way. For example, when I fetch entries from redis and show them, they lose their order (from user with highest contributions to lowest). Is it better to store the whole object as a string in a list?
Other than this, we can merge it I think once finished.
@paulodiovani
I just pushed another commit to the same branch. I think the approach of savings the individual objects as strings in an ordered list makes the most sense. At least for me! I am not sure how that will affect our ability to do searches and stuff. Waiting to hear your opinion @paulodiovani
I'm not sure... :thinking: we can store in lists or hashes and let the grouping and ordering to javascript (which could overflow server memory), or we can store in sorted sets to allow controlling the sort order.
Another option would be use at least two collections, one for usernames and others for pull requests:
sorted set
for usernames (key: users
) with the score updated to show our rankset
for each user (key: pull-requests:@username
) with the pull requests
sets don't allow duplicated values, so we can guarantee that we never add a pr twiceI like the structure you suggested. I think by making two collections, we can optimize our db operations. I will try to implement it.
done.
Database will be, for start, just a long-term cache to prevent fetch from github api all the time. Redis would be good enough but we could also use Postgress or MongoDB as alternative.
The database should keep a cache of contributions per user and links to pull requests. We can simple store username alongside pull request link to allow search/filter/group by user.
Suggested schema:
user: String (github username) project: String (project name) pull_request: String (pull request link)