{"id":22511137,"url":"https://github.com/renderedtext/ex-cacheman","last_synced_at":"2026-02-27T02:31:37.012Z","repository":{"id":53730110,"uuid":"252192754","full_name":"renderedtext/ex-cacheman","owner":"renderedtext","description":"Cacheman is a Redis backed Rails.cache equivalent for Elixir applications.","archived":false,"fork":false,"pushed_at":"2025-02-20T14:45:04.000Z","size":58,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-03T14:42:42.111Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/renderedtext.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}},"created_at":"2020-04-01T14:07:07.000Z","updated_at":"2025-02-20T14:45:10.000Z","dependencies_parsed_at":"2023-01-31T01:01:00.834Z","dependency_job_id":null,"html_url":"https://github.com/renderedtext/ex-cacheman","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/renderedtext/ex-cacheman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renderedtext%2Fex-cacheman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renderedtext%2Fex-cacheman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renderedtext%2Fex-cacheman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renderedtext%2Fex-cacheman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/renderedtext","download_url":"https://codeload.github.com/renderedtext/ex-cacheman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/renderedtext%2Fex-cacheman/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29883101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-07T02:09:13.335Z","updated_at":"2026-02-27T02:31:36.986Z","avatar_url":"https://github.com/renderedtext.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cacheman\n\nCacheman is a Redis backed Rails.cache equivalent for Elixir applications.\n\nThe primary API for using Cacheman is Cacheman.fetch.\n\n## Install\n\nAdd Cacheman to your mix file\n\n``` elixir\ndefp deps do\n  [\n    {:cacheman, github: \"renderedtext/ex-cacheman\"}\n  ]\nend\n```\n\n## How to use\n\nAdd an instance of cache to your app's supervisor:\n\n``` elixir\n  cache_name = :app\n  cache_opts = %{\n    prefix: \"example/\",       # every key in the cache store will be prefixed with example/\n    backend: %{\n      type: :redis,           # redis for backend\n      host: \"localhost\",      # redis instance is listening on localhost\n      port: 6379,             # redis instance is listening on port 6379\n      pool_size: 5            # 5 parallel connections are established to the cache server\n    }\n  }\n\n  children = [\n    {Cacheman, [cache_name, cache_opts]}\n  ]\n```\n\nFetch from the Cache, with a fallback function in case the entry is not found:\n\n``` elixir\n{:ok, dash} = Cacheman.fetch(:app, \"users-#{user.id}-dashboard\", fn -\u003e\n  {:ok, dashboard} = render_dashboard(user)\nend)\n```\n\nThe fallback function saves everything into the cache that has the\n`{:ok, value}` format.\n\n## Advanced usage (TTL, and low level get/put APIs)\n\nTTL for entries:\n\n``` elixir\n{:ok, dash} = Cacheman.fetch(:app, \"users-#{user.id}-dashboard\", ttl: :timer.hours(6), fn -\u003e render_dashboard(user) end)\n```\n\nGet a key:\n\n``` elixir\n{:ok, entry} = Cacheman.get(:app, \"user-#{user.id}-dashboard\")\n```\n\nPut values in cache:\n\n``` elixir\n{:ok, dashboard} = render_dashboard(user)\n\n{:ok, _} = Cacheman.put(:app, \"user-#{user.id}-dashboard\", dashboard, ttl: :timer.hours(6))\n```\n\n## Multiplexing caches\n\nEvery Cacheman instance must define a cache key prefix. This allows multiplexing\nof caches across multiple clients or areas of work.\n\nExample, a dedicated namespace for user caches and project caches:\n\n``` elixir\n{:ok, _} = Cacheman.start_link(:user, %{\n  prefix: \"users/\",\n  backend: %{\n    type: :redis,\n    host: \"redis\",\n    port: 6379,\n    pool_size: 5\n  }\n})\n\n{:ok, _} = Cacheman.start_link(:project, %{\n  prefix: \"projects/\",\n  backend: %{\n    type: :redis,\n    host: \"redis\",\n    port: 6379,\n    pool_size: 5\n  }\n})\n```\n\n## License\n\nThis software is licensed under [the Apache 2.0 license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenderedtext%2Fex-cacheman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frenderedtext%2Fex-cacheman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frenderedtext%2Fex-cacheman/lists"}