{"id":21672416,"url":"https://github.com/redis-developer/basic-caching-redis-demo-go-lang","last_synced_at":"2025-04-12T03:53:03.163Z","repository":{"id":51023978,"uuid":"342768498","full_name":"redis-developer/basic-caching-redis-demo-go-lang","owner":"redis-developer","description":"Basic caching redis demo app written in GO language","archived":false,"fork":false,"pushed_at":"2023-06-27T07:20:06.000Z","size":3951,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-12T03:52:58.068Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","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":"LICENSE","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-27T04:17:02.000Z","updated_at":"2023-06-27T07:20:10.000Z","dependencies_parsed_at":"2024-06-21T17:50:11.942Z","dependency_job_id":"30adb7fd-de9d-439d-9ae2-f4649dae64ec","html_url":"https://github.com/redis-developer/basic-caching-redis-demo-go-lang","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-caching-redis-demo-go-lang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-caching-redis-demo-go-lang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-caching-redis-demo-go-lang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fbasic-caching-redis-demo-go-lang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/basic-caching-redis-demo-go-lang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514209,"owners_count":21116899,"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:29:14.269Z","updated_at":"2025-04-12T03:53:03.143Z","avatar_url":"https://github.com/redis-developer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv style=\"height: 150px\"\u003e\u003c/div\u003e\n\n# Basic Redis Caching Demo\n\nThis app returns the number of repositories a Github account has. When you first search for an account, the server calls Github's API to return the response. This can take 100s of milliseconds. The server then adds the details of this slow response to Redis for future requests. When you search again, the next response comes directly from Redis cache instead of calling Github. The responses are usually usually in a millisecond or so making it blazing fast.\n\n# Overview video\n\nHere's a short video that explains the project and how it uses Redis:\n\n[![Watch the video on YouTube](https://github.com/redis-developer/basic-caching-redis-demo-go-lang/raw/master/docs/YTThumbnail.png)](https://youtube.com/watch?v=Ov18gLo0Da8)\n\n## How it works?\n\n![How it works](https://github.com/redis-developer/basic-caching-redis-demo-go-lang/raw/master/docs/screenshot001.png)\n\n### 1. How the data is stored:\n\n- Set the number of repositories for the account (use the user name for key): `SETEX \u003caccount name\u003e \u003cseconds till expire\u003e \u003cnumber of public repos\u003e`\n  - E.g `SETEX microsoft 3600 197`\n\n##### Code example:\n\n```Go\nerr = c.r.Set(username, strconv.Itoa(repo.PublicRepos), time.Hour)\nif err != nil {\n    return nil, err\n}\n```\n\n### 2. How the data is accessed:\n\n- Get number of public repositories for an account: `GET \u003caccount name\u003e`\n  - E.g `GET microsoft`\n\n##### Code example:\n\n```Go\nvalue, err := c.r.Get(username)\nif err == redis.Nil {\n    // ...\n```\n\n## How to run it locally?\n\nMake sure you set environment variables (provided in **.env.example**):\n\n```\nAPI_HOST=\nAPI_PORT=5000\nAPI_PUBLIC_PATH=/public\nREDIS_HOST=caching-redis\nREDIS_PORT=6379\nREDIS_PASSWORD=\n```\n\n#### Run application\n\n```sh\ngo run\n```\n\nFollow: http://localhost:5000\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-caching-redis-demo-go-lang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fbasic-caching-redis-demo-go-lang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fbasic-caching-redis-demo-go-lang/lists"}