{"id":19298205,"url":"https://github.com/casbin/redis-adapter","last_synced_at":"2025-04-06T06:13:17.881Z","repository":{"id":25734114,"uuid":"104492269","full_name":"casbin/redis-adapter","owner":"casbin","description":"Redis adapter for Casbin","archived":false,"fork":false,"pushed_at":"2024-03-09T01:45:17.000Z","size":41,"stargazers_count":194,"open_issues_count":2,"forks_count":26,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-29T22:37:48.913Z","etag":null,"topics":["access-control","adapter","auth","authorization","authz","casbin","redis","storage-driver"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/casbin.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},"funding":{"github":"casbin"}},"created_at":"2017-09-22T15:50:16.000Z","updated_at":"2024-09-21T19:52:15.000Z","dependencies_parsed_at":"2024-03-25T09:21:38.237Z","dependency_job_id":"19117767-bb6c-422c-9e8d-742ae6f14104","html_url":"https://github.com/casbin/redis-adapter","commit_stats":{"total_commits":31,"total_committers":19,"mean_commits":1.631578947368421,"dds":0.6774193548387097,"last_synced_commit":"00e084bf1709b4f18475b32df45271993373d2df"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fredis-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fredis-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fredis-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/casbin%2Fredis-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/casbin","download_url":"https://codeload.github.com/casbin/redis-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441059,"owners_count":20939239,"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":["access-control","adapter","auth","authorization","authz","casbin","redis","storage-driver"],"created_at":"2024-11-09T23:07:15.336Z","updated_at":"2025-04-06T06:13:17.865Z","avatar_url":"https://github.com/casbin.png","language":"Go","funding_links":["https://github.com/sponsors/casbin"],"categories":["Go"],"sub_categories":[],"readme":"Redis Adapter\n====\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/casbin/redis-adapter)](https://goreportcard.com/report/github.com/casbin/redis-adapter)\n[![Build](https://github.com/casbin/redis-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/redis-adapter/actions/workflows/ci.yml)\n[![Coverage Status](https://coveralls.io/repos/github/casbin/redis-adapter/badge.svg?branch=master)](https://coveralls.io/github/casbin/redis-adapter?branch=master)\n[![Godoc](https://godoc.org/github.com/casbin/redis-adapter?status.svg)](https://pkg.go.dev/github.com/casbin/redis-adapter/v3)\n[![Release](https://img.shields.io/github/release/casbin/redis-adapter.svg)](https://github.com/casbin/redis-adapter/releases/latest)\n[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord\u0026label=discord\u0026color=5865F2)](https://discord.gg/S5UjpzGZjN)\n[![Sourcegraph](https://sourcegraph.com/github.com/casbin/redis-adapter/-/badge.svg)](https://sourcegraph.com/github.com/casbin/redis-adapter?badge)\n\nRedis Adapter is the [Redis](https://redis.io/) adapter for [Casbin](https://github.com/casbin/casbin). With this library, Casbin can load policy from Redis or save policy to it.\n\n## Installation\n\n    go get github.com/casbin/redis-adapter/v3\n\n## Simple Example\n\n```go\npackage main\n\nimport (\n\t\"github.com/casbin/casbin/v2\"\n\t\"github.com/casbin/redis-adapter/v3\"\n)\n\nfunc main() {\n\t// Direct Initialization:\n\t// Initialize a Redis adapter and use it in a Casbin enforcer:\n\ta, _ := redisadapter.NewAdapter(\"tcp\", \"127.0.0.1:6379\") // Your Redis network and address.\n\n\t// Use the following if Redis has password like \"123\"\n\t// a, err := redisadapter.NewAdapterWithPassword(\"tcp\", \"127.0.0.1:6379\", \"123\")\n\n\t// Use the following if you use Redis with a specific user \n\t// a, err := redisadapter.NewAdapterWithUser(\"tcp\", \"127.0.0.1:6379\", \"username\", \"password\")\n\n\t// Use the following if you use Redis connections pool\n\t// pool := \u0026redis.Pool{}\n\t// a, err := redisadapter.NewAdapterWithPool(pool)\n\n\t// Initialization with different user options:\n\t// Use the following if you use Redis with passowrd like \"123\":\n\t// a, err := redisadapter.NewAdapterWithOption(redisadapter.WithNetwork(\"tcp\"), redisadapter.WithAddress(\"127.0.0.1:6379\"), redisadapter.WithPassword(\"123\"))\n\n\t// Use the following if you use Redis with username, password, and TLS option:\n\t// var clientTLSConfig tls.Config\n\t// ...\n\t// a, err := redisadapter.NewAdapterWithOption(redisadapter.WithNetwork(\"tcp\"), redisadapter.WithAddress(\"127.0.0.1:6379\"), redisadapter.WithUsername(\"testAccount\"), redisadapter.WithPassword(\"123456\"), redisadapter.WithTls(\u0026clientTLSConfig))\n\n\te, _ := casbin.NewEnforcer(\"examples/rbac_model.conf\", a)\n\n\t// Load the policy from DB.\n\te.LoadPolicy()\n\n\t// Check the permission.\n\te.Enforce(\"alice\", \"data1\", \"read\")\n\n\t// Modify the policy.\n\t// e.AddPolicy(...)\n\t// e.RemovePolicy(...)\n\n\t// Save the policy back to DB.\n\te.SavePolicy()\n}\n```\n\n## Getting Help\n\n- [Casbin](https://github.com/casbin/casbin)\n\n## License\n\nThis project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin%2Fredis-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcasbin%2Fredis-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcasbin%2Fredis-adapter/lists"}