{"id":21672556,"url":"https://github.com/redis-developer/basic-redis-leaderboard-demo-java","last_synced_at":"2025-03-20T08:27:11.984Z","repository":{"id":51024294,"uuid":"338043150","full_name":"redis-developer/basic-redis-leaderboard-demo-java","owner":"redis-developer","description":"A basic Redis Leaderboard app written in Java","archived":false,"fork":false,"pushed_at":"2023-06-27T07:38:39.000Z","size":5806,"stargazers_count":2,"open_issues_count":1,"forks_count":7,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-25T09:27:38.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis-developer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-11T13:54:26.000Z","updated_at":"2024-05-29T21:06:25.000Z","dependencies_parsed_at":"2025-01-25T09:35:59.459Z","dependency_job_id":null,"html_url":"https://github.com/redis-developer/basic-redis-leaderboard-demo-java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-redis-leaderboard-demo-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/basic-redis-leaderboard-demo-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244576965,"owners_count":20475219,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T13:30:03.388Z","updated_at":"2025-03-20T08:27:11.962Z","avatar_url":"https://github.com/redis-developer.png","language":"Vue","readme":"# Basic Redis Leaderboard Demo Java (Spring)\n\nA basic leaderboard application using Redis and Java/Spring. The application models public companies and their market capitalization.\n\n## Try it out\n\n\u003cp\u003e\n    \u003ca href=\"https://heroku.com/deploy\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://www.herokucdn.com/deploy/button.svg\" alt=\"Deploy to Heroku\" width=\"200px\"/\u003e\n    \u003ca\u003e\n\u003c/p\u003e\n\u003cp\u003e\n    \u003ca href=\"https://deploy.cloud.run?dir=server\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://deploy.cloud.run/button.svg\" alt=\"Run on Google Cloud\" width=\"200px\"/\u003e\n    \u003c/a\u003e\n    (See notes: How to run on Google Cloud)\n\u003c/p\u003e\n\n## How to run on Google Cloud\n\n\u003cp\u003e\n    If you don't have redis yet, plug it in  (https://spring-gcp.saturnism.me/app-dev/cloud-services/cache/memorystore-redis).\n    After successful deployment, you need to manually enable the vpc connector as shown in the pictures:\n\u003c/p\u003e\n\n1. Click on \"Run on Google Cloud\"\n\n![1 step](https://raw.githubusercontent.com/redis-developer/basic-redis-leaderboard-demo-java/master/1.jpg)\n\n2. Click \"Edit and deploy new revision\" button and choose \"Variables and Secrets\".\n\n![2 step](https://raw.githubusercontent.com/redis-developer/basic-redis-leaderboard-demo-java/master/2.jpg)\n\n3. Manage the traffic\n\n\n![3  step](https://raw.githubusercontent.com/redis-developer/basic-redis-leaderboard-demo-java/master/docs/3.jpg)\n\n\u003ca href=\"https://github.com/GoogleCloudPlatform/cloud-run-button/issues/108#issuecomment-554572173\"\u003e\nProblem with unsupported flags when deploying google cloud run button\n\u003c/a\u003e\n\n## How it works?\n\n\n## 1. How the data is stored:\n\n####  How the data is stored:\n\n- The AAPL's details - market cap of 2.6 triillions and USA origin - are stored in a hash like below:\n  ```bash\n   HSET \"company:AAPL\" symbol \"AAPL\" market_cap \"2600000000000\" country USA\n  ```\n\n- The Ranks of AAPL of 2.6 trillions are stored in a ZSET.\n\n   ```bash\n    ZADD  companyLeaderboard 2600000000000 company:AAPL\n   ```\n\n####  How the data is accessed:\n\n- Top 10 companies:\n\n  ```bash\n   ZREVRANGE companyLeaderboard 0 9 WITHSCORES\n  ```\n\n- All companies:\n\n  ```bash\n   ZREVRANGE companyLeaderboard 0 -1 WITHSCORES\n  ```\n\n- Bottom 10 companies:\n\n  ```bash\n   ZRANGE companyLeaderboard 0 9 WITHSCORES\n  ```\n\n- Between rank 10 and 15:\n\n  ```bash\n   ZREVRANGE companyLeaderboard 9 14 WITHSCORES\n  ```\n\n- Show ranks of AAPL, FB and TSLA:\n\n  ```bash\n   ZREVRANGE  companyLeaderBoard company:AAPL company:FB company:TSLA\n  ```\n\n- Adding 1 billion to market cap of FB company:\n\n  ```bash\n   ZINCRBY companyLeaderBoard 1000000000 \"company:FB\"\n  ```\n\n- Reducing 1 billion of market cap of FB company:\n\n  ```bash\n   ZINCRBY companyLeaderBoard -1000000000 \"company:FB\"\n  ```\n\n- Companies between 500 billion and 1 trillion:\n\n  ```bash\n   ZCOUNT companyLeaderBoard 500000000000 1000000000000\n  ```\n\n- Companies over a Trillion:\n\n   ```bash\n    ZCOUNT companyLeaderBoard 1000000000000 +inf\n   ```\n\n\n## How to run it locally?\n\n#### Open the files server/.env.example to see the available environment variables. You may set these variables when you start the application.\n   \t- REDIS_URL: Redis server url\n    - REDIS_HOST: Redis server host\n\t- REDIS_PORT: Redis server port\n\t- REDIS_PASSWORD: Redis server password\n\n#### Run backend\n\n1. Install gradle (Use Gradle 6.3 or later) (on mac: https://gradle.org/install/) \n\n2. Install JDK (use 8 or later version) (on mac: https://docs.oracle.com/javase/10/install/installation-jdk-and-jre-macos.htm)\n\n3. Set any relevant environment variables (if not connecting to Redis on localhost:6379). For example:\n\n``` sh\n$ REDIS_PORT=6379\n```\n\n3. From the root directory of the project, run the following commands:\n``` sh\ncd server\n./gradlew build\n./gradlew run\n```\n\n4. Point your browser to `localhost:5000`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-redis-leaderboard-demo-java/lists"}