{"id":22561774,"url":"https://github.com/bpcloud/middleware-redis","last_synced_at":"2026-02-08T18:06:00.841Z","repository":{"id":79322749,"uuid":"356246714","full_name":"bpcloud/middleware-redis","owner":"bpcloud","description":"redis middleware of bpframework","archived":false,"fork":false,"pushed_at":"2025-01-20T08:29:36.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T21:08:52.119Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/bpcloud.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,"publiccode":null,"codemeta":null}},"created_at":"2021-04-09T11:30:03.000Z","updated_at":"2025-01-20T08:29:37.000Z","dependencies_parsed_at":"2025-02-07T19:40:47.497Z","dependency_job_id":null,"html_url":"https://github.com/bpcloud/middleware-redis","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"874dc9c84f2ff5b59428d4a531252da325f05762"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpcloud%2Fmiddleware-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpcloud","download_url":"https://codeload.github.com/bpcloud/middleware-redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111975,"owners_count":21049578,"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-12-07T22:09:44.579Z","updated_at":"2026-02-08T18:05:58.833Z","avatar_url":"https://github.com/bpcloud.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redis middleware in bpframework.\n\n### Middleware specification\n\nhttps://github.com/bpcloud/middleware\n\n### usage\n\n\n#### Setup.\n\n```js\nimport { Application } from 'bpframework';\nimport * as middleware_redis from '@bpframework/middleware-redis';\n\nApplication.use(middleware_redis.middleware)\nApplication.runKoa(...);\n```\n\n#### Config.\n\n```properties\nspring.redis:\n  database: 0     # Redis数据库索引（默认为0)\n  host: 127.0.0.1 # 单机模式host (优先使用此配置).\n  port: 6379      # 单机模式port.\n  cluster:        # 集群模式主机信息.\n    nodes:          # Redis服务器地址列表\n    - host: 127.0.0.1\n      port: 6379\n    - host: 127.0.0.1\n      port: 6380\n    - host: 127.0.0.1\n      port: 6381\n  password:       # Redis服务器连接密码（默认为空） \n  timeout: 0      # 连接超时时间（毫秒）\n  default-ttl:           5    # 默认的ttl; 单位秒, 默认5分钟. (默认的过期时间对hash表无效, hash需单独设置) \n  default-ttl-tolerance: 10   # 单位秒; ttl时间增加这个抖动范围, 默认10秒\n```\n\n#### Define Bean.\n\n```js\n@Service()\nclass Configure {\n  @Bean()\n  redisTemplate(): RedisTemplate {\n    return new RedisTemplate(\"spring.redis\");\n  }\n}\n```\n\n#### Use.\n\n```js\n@Service()\nclass RedisService {\n\n  @Autowired(\"redisTemplate\")\n  redisTemplate: RedisTemplate;\n\n  async foo(): Promise\u003cstring[]\u003e {\n    return await this.redisTemplate.keys(\"*\");\n  }\n}\n```\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpcloud%2Fmiddleware-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpcloud%2Fmiddleware-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpcloud%2Fmiddleware-redis/lists"}