{"id":22217288,"url":"https://github.com/saufiroja/example-redis-go","last_synced_at":"2026-04-16T10:36:04.205Z","repository":{"id":211295800,"uuid":"728729166","full_name":"saufiroja/example-redis-go","owner":"saufiroja","description":"example implementation redis in go","archived":false,"fork":false,"pushed_at":"2023-12-09T06:50:06.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T01:02:13.795Z","etag":null,"topics":["caching","docker","docker-compose","go","golang","redis"],"latest_commit_sha":null,"homepage":"","language":"Go","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/saufiroja.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":"2023-12-07T15:08:36.000Z","updated_at":"2023-12-07T16:06:50.000Z","dependencies_parsed_at":"2023-12-07T17:26:56.712Z","dependency_job_id":"6eac3369-d899-4fa5-a125-d7e10094a8be","html_url":"https://github.com/saufiroja/example-redis-go","commit_stats":null,"previous_names":["saufiroja/example-redis-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fexample-redis-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fexample-redis-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fexample-redis-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saufiroja%2Fexample-redis-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saufiroja","download_url":"https://codeload.github.com/saufiroja/example-redis-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245414543,"owners_count":20611367,"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":["caching","docker","docker-compose","go","golang","redis"],"created_at":"2024-12-02T22:15:56.200Z","updated_at":"2026-04-16T10:35:59.175Z","avatar_url":"https://github.com/saufiroja.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What Is Redis?\n\nRedis (Remote Dictionary Server) is a memory-based key-value database system used as a database, cache, and message broker. Redis itself is one of the NoSQL databases that is very popular because of its speed as a database system for storage. As explained, redis stores the main data in memory (RAM).\n\nBecause of this speed, redis is usually used for cache systems in applications. Redis is also used to support RDBMS performance for storing certain key data.\n\n# What Is Caching?\n\nCaching is the process of storing frequently used data into memory so that it can be accessed more quickly. This is very useful because memory access is faster than access to main storage such as databases. Because storing data in memory the system can access it faster. Caching can also reduce the server connection load.\n\n# How Redis Works?\n\n\u003cdiv align=\"center\" style=\"background-color: white; padding: 20px;\"\u003e\n  \u003cimg src=\"./images/before.png\" alt=\"Before Redis\" /\u003e\n\u003c/div\u003e\n\nWhen the application receives a data request, it will first check if the data is already available in the Redis cache.\n\u003c/br\u003e\nIf it is not found in the cache, the application will retrieve the data from the database.\n\u003c/br\u003e\nAfter getting the data, the application will provide a response and store the results into the Redis cache as keys and values.\n\n\u003cdiv align=\"center\" style=\"background-color: white; padding: 20px;\"\u003e\n  \u003cimg src=\"./images/after.png\" alt=\"After Redis\" /\u003e\n\u003c/div\u003e\nOn subsequent data requests, the application will look for the response data in the Redis cache without the need to query the database again.\n\n# Benefits of Redis?\n\n- Faster and more efficient process → With the cache, data response will be faster.\n- Can reduce costs → Caching can reduce application workload, because it does not always query directly to the database to get data.\n- Good scalability → With its speed, redis can meet the needs of high requests.\n\n# Installing Redis\n\nYou can install Redis on Linux, Windows, and macOS. You can also use Docker to run Redis.\nBut in this tutorial, we will use Docker to run Redis.\n\n```bash\nmake build\n```\n\n# Basic Operations in Redis\n\n1. Set data\n\n```go\nerr := client.Set(ctx, \"key\", \"value\", 0).Err()\nif err != nil {\n\tfmt.Println(\"Error setting key:\", err)\n\treturn\n}\n```\n\n2. Get data\n\n```go\nval, err := client.Get(ctx, \"key\").Result()\nif err != nil {\n\tfmt.Println(\"Error getting key:\", err)\n\treturn\n}\n\nfmt.Println(\"Key value:\", val)\n```\n\n3. Delete data\n\n```go\nerr := client.Del(ctx, \"key\").Err()\nif err != nil {\n\tfmt.Println(\"Error deleting key:\", err)\n\treturn\n}\n```\n\n# Usage\n\n1. Run the application in local\n\n```bash\nmake run\n```\n\n2. You can try the endpoints using Postman or curl\n\n```bash\ncurl http://localhost:8080/\n```\n\n3. Run the with test\n\n```bash\nmake test\n```\n\nIf you want see data in redis, you can use open gui redis in browser\n\n```bash\nuser: root\npassword: root\n\nhttp://localhost:8081/\n```\n\nAfter that, you can see data in redis\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaufiroja%2Fexample-redis-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaufiroja%2Fexample-redis-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaufiroja%2Fexample-redis-go/lists"}