{"id":13895747,"url":"https://github.com/leafo/lapis-redis","last_synced_at":"2025-05-12T20:14:37.789Z","repository":{"id":19531660,"uuid":"22779271","full_name":"leafo/lapis-redis","owner":"leafo","description":"Redis integration for Lapis","archived":false,"fork":false,"pushed_at":"2021-02-08T23:08:06.000Z","size":6,"stargazers_count":25,"open_issues_count":4,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T17:39:48.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","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/leafo.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":"2014-08-09T05:07:48.000Z","updated_at":"2024-12-21T12:58:31.000Z","dependencies_parsed_at":"2022-07-23T03:46:16.214Z","dependency_job_id":null,"html_url":"https://github.com/leafo/lapis-redis","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flapis-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafo","download_url":"https://codeload.github.com/leafo/lapis-redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253814988,"owners_count":21968561,"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-08-06T18:02:26.632Z","updated_at":"2025-05-12T20:14:37.755Z","avatar_url":"https://github.com/leafo.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"\n# `lapis-redis`\n\nThis module is used for integrating [Redis](http://redis.io) with\n[Lapis](http://leafo.net/lapis). It uses the\n[`lua-resty-redis`](https://github.com/openresty/lua-resty-redis) module.\n\n## Installing\n\n```bash\n$ luarocks install lapis-redis\n```\n\n## Configuring\n\n```moonscript\n-- config.moon\n\nconfig \"development\", -\u003e\n  redis {\n    host: \"127.0.0.1\"\n    port: 6379\n  }\n\n```\n\n## Connecting\n\nThe function `get_redis` can be used to get the current request's Redis\nconnection. If there's not connection established for the request a new one\nwill be opened. After the request completes the Redis connection will\nautomatically be recycled for future requests.\n\nThe return value of `get_redis` is a connected\n[`lua-resty-redis`](https://github.com/openresty/lua-resty-redis#methods)\nobject.\n\n```moon\nimport get_redis from require \"lapis.redis\"\n\nclass App extends lapis.Application\n  \"/\": =\u003e\n    redis = get_redis!\n    redis\\set \"hello\", \"world\"\n\n    redis\\get \"hello\"\n```\n\n\n## Redis cache\n\nYou can use Redis as a cache using the [Lapis caching\nAPI](http://leafo.net/lapis/reference/utilities.html#caching-cachedfn_or_tbl).\n\n```moon\nimport cached from require \"lapis.cache\"\nimport redis_cache from require \"lapis.redis\"\n\nclass App extends lapis.Application\n  \"/hello\": cached {\n    dict: redis_cache \"cache-prefix\"\n    =\u003e\n      @html -\u003e\n        div \"hello\"\n  }\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Flapis-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafo%2Flapis-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Flapis-redis/lists"}