{"id":13781683,"url":"https://github.com/thinkjs/think-redis","last_synced_at":"2025-10-11T07:02:53.415Z","repository":{"id":54325189,"uuid":"85698981","full_name":"thinkjs/think-redis","owner":"thinkjs","description":"ThinkJS redis","archived":false,"fork":false,"pushed_at":"2021-02-24T00:24:41.000Z","size":18,"stargazers_count":9,"open_issues_count":0,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-30T12:02:35.458Z","etag":null,"topics":["redis","thinkjs3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"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/thinkjs.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":"2017-03-21T12:26:26.000Z","updated_at":"2021-02-25T10:08:10.000Z","dependencies_parsed_at":"2022-08-13T12:01:09.312Z","dependency_job_id":null,"html_url":"https://github.com/thinkjs/think-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/thinkjs%2Fthink-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkjs%2Fthink-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkjs","download_url":"https://codeload.github.com/thinkjs/think-redis/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522316,"owners_count":20952520,"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":["redis","thinkjs3"],"created_at":"2024-08-03T18:01:28.203Z","updated_at":"2025-10-11T07:02:48.383Z","avatar_url":"https://github.com/thinkjs.png","language":"JavaScript","readme":"# think-redis\n[![Build Status](https://travis-ci.org/thinkjs/think-redis.svg?branch=master)](https://travis-ci.org/thinkjs/think-redis)\n[![Coverage Status](https://coveralls.io/repos/github/thinkjs/think-redis/badge.svg?branch=master)](https://coveralls.io/github/thinkjs/think-redis?branch=master)\n[![npm](https://img.shields.io/npm/v/think-redis.svg?style=flat-square)](https://www.npmjs.com/package/think-redis)\n\n\n## Install\n\n```\nnpm install think-redis\n```\n\n## How to Use\n\n### default options\n\nYou can find all the config options at https://github.com/luin/ioredis/blob/master/lib/redis.js\n\n```js\nconst defaultConfig = {\n  port: 6379,          // Redis port\n  host: '127.0.0.1',   // Redis host\n  password: '',\n};\n```\n\n### usage\n\n```js\nimport Redis from '../index';\n\nlet redisInst = new Redis(config);\n\n// set key\nlet s1 = await redisInst.set('name2', 'lushijie'); // never expire\nlet s2 = await redisInst.set('name3', 'lushijie', 3000); // milliseconds\nlet s3 = await redisInst.set('name4', 'lushijie', 'EX', 5); //seconds\nlet s4 = await redisInst.set('name5', 'lushijie', 'PX', 10000); //milliseconds\n\n// get key's value\nlet g1 = await redisInst.get('name2');\n\n// delete key\nlet d1 = await redisInst.delete(key);\n\n// add event listener, supported events see at https://github.com/luin/ioredis\nredisInst.on('connect', function() {\n  // todo\n});\n\n// increase 1, if key not exist, set key's value eq 0 and then increase 1\nawait redisInst.increase(key);\n\n// decrease 1, if key not exist, set key's value eq 0 then decrease 1\nawait redisInst.decrease(key);\n\n```\n\n","funding_links":[],"categories":["Others"],"sub_categories":["websocket"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkjs%2Fthink-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkjs%2Fthink-redis/lists"}