{"id":28353109,"url":"https://github.com/gmtprime/yggdrasil_redis","last_synced_at":"2026-04-29T09:35:31.366Z","repository":{"id":57558218,"uuid":"146313739","full_name":"gmtprime/yggdrasil_redis","owner":"gmtprime","description":"Redis adapter for Yggdrasil","archived":false,"fork":false,"pushed_at":"2019-01-22T15:43:55.000Z","size":250,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T10:23:29.936Z","etag":null,"topics":["elixir","pubsub","redis","yggdrasil"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/gmtprime.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}},"created_at":"2018-08-27T15:02:51.000Z","updated_at":"2019-01-22T15:43:56.000Z","dependencies_parsed_at":"2022-08-28T09:30:43.647Z","dependency_job_id":null,"html_url":"https://github.com/gmtprime/yggdrasil_redis","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/gmtprime/yggdrasil_redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmtprime%2Fyggdrasil_redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmtprime%2Fyggdrasil_redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmtprime%2Fyggdrasil_redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmtprime%2Fyggdrasil_redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gmtprime","download_url":"https://codeload.github.com/gmtprime/yggdrasil_redis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gmtprime%2Fyggdrasil_redis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["elixir","pubsub","redis","yggdrasil"],"created_at":"2025-05-28T00:10:43.920Z","updated_at":"2026-04-29T09:35:31.361Z","avatar_url":"https://github.com/gmtprime.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redis adapter for Yggdrasil\n\n[![Build Status](https://travis-ci.org/gmtprime/yggdrasil_redis.svg?branch=master)](https://travis-ci.org/gmtprime/yggdrasil_redis) [![Hex pm](http://img.shields.io/hexpm/v/yggdrasil_redis.svg?style=flat)](https://hex.pm/packages/yggdrasil_redis) [![hex.pm downloads](https://img.shields.io/hexpm/dt/yggdrasil_redis.svg?style=flat)](https://hex.pm/packages/yggdrasil_redis)\n\nThis project is a Redis adapter for `Yggdrasil` publisher/subscriber.\n\n## Small example\n\nThe following example uses Redis adapter to distribute messages:\n\n```elixir\niex(1)\u003e channel = %Yggdrasil.Channel{name: \"some_channel\", adapter: :redis}\niex(2)\u003e Yggdrasil.subscribe(channel)\niex(3)\u003e flush()\n{:Y_CONNECTED, %Yggdrasil.Channel{(...)}}\n```\n\nand to publish a message for the subscribers:\n\n```elixir\niex(4)\u003e Yggdrasil.publish(channel, \"message\")\niex(5)\u003e flush()\n{:Y_EVENT, %Yggdrasil.Channel{(...)}, \"message\"}\n```\n\nWhen the subscriber wants to stop receiving messages, then it can unsubscribe\nfrom the channel:\n\n```elixir\niex(6)\u003e Yggdrasil.unsubscribe(channel)\niex(7)\u003e flush()\n{:Y_DISCONNECTED, %Yggdrasil.Channel{(...)}}\n```\n\n## Redis adapter\n\nThe Redis adapter has the following rules:\n  * The `adapter` name is identified by the atom `:redis`.\n  * The channel `name` must be a string.\n  * The `transformer` must encode to a string. From the `transformer`s provided\n  it defaults to `:default`, but `:json` can also be used.\n  * Any `backend` can be used (by default is `:default`).\n\nThe following is an example of a valid channel for both publishers and\nsubscribers:\n\n```elixir\n%Yggdrasil.Channel{\n  name: \"redis_channel_name\",\n  adapter: :redis,\n  transformer: :json\n}\n```\n\nIt will expect valid JSONs from Redis and it will write valid JSONs in Redis.\n\n## Redis configuration\n\nUses the list of options for `Redix`, but the more relevant optuons are shown\nbelow:\n  * `hostname` - Redis hostname (defaults to `\"localhost\"`).\n  * `port` - Redis port (defaults to `6379`).\n  * `password` - Redis password (defaults to `\"\"`).\n\nThe following shows a configuration with and without namespace:\n\n```elixir\n# Without namespace\nconfig :yggdrasil,\n  redis: [hostname: \"redis.zero\"]\n\n# With namespace\nconfig :yggdrasil, RedisOne,\n  redis: [\n    hostname: \"redis.one\",\n    port: 1234\n  ]\n```\n\nAlso the options can be provided as OS environment variables. The available\nvariables are:\n\n  * `YGGDRASIL_REDIS_HOSTNAME` or `\u003cNAMESPACE\u003e_YGGDRASIL_REDIS_HOSTNAME`.\n  * `YGGDRASIL_REDIS_PORT` or `\u003cNAMESPACE\u003e_YGGDRASIL_REDIS_PORT`.\n  * `YGGDRASIL_REDIS_PASSWORD` or `\u003cNAMESPACE\u003e_YGGDRASIL_REDIS_PASSWORD`.\n  * `YGGDRASIL_REDIS_DATABASE` or `\u003cNAMESPACE\u003e_YGGDRASIL_REDIS_DATABASE`.\n\nwhere `\u003cNAMESPACE\u003e` is the snakecase of the namespace chosen e.g. for the\nnamespace `RedisTwo`, you would use `REDIS_TWO` as namespace in the OS\nenvironment variable.\n\n## Installation\n\nUsing this Redis adapter with `Yggdrasil` is a matter of adding the available\nhex package to your `mix.exs` file e.g:\n\n```elixir\ndef deps do\n  [{:yggdrasil_redis, \"~\u003e 4.1\"}]\nend\n```\n\n## Running the tests\n\nA `docker-compose.yml` file is provided with the project. If  you don't have a\nRedis database, but you do have Docker installed, then just do:\n\n```\n$ docker-compose up --build\n```\n\nAnd in another shell run:\n\n```\n$ mix deps.get\n$ mix test\n```\n\n## Relevant projects used\n\n  * [`Redix.PubSub`](https://github.com/whatyouhide/redix_pubsub): Redis pubsub.\n\n## Author\n\nAlexander de Sousa.\n\n## License\n\n`Yggdrasil` is released under the MIT License. See the LICENSE file for further\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmtprime%2Fyggdrasil_redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgmtprime%2Fyggdrasil_redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgmtprime%2Fyggdrasil_redis/lists"}