Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m-sardari/redis
Redis is an open source, in-memory data structure store used as a database, cache, message broker, and streaming engine.
https://github.com/m-sardari/redis
javascript nest nestjs nodejs redis typescript
Last synced: 3 months ago
JSON representation
Redis is an open source, in-memory data structure store used as a database, cache, message broker, and streaming engine.
- Host: GitHub
- URL: https://github.com/m-sardari/redis
- Owner: M-Sardari
- License: mit
- Created: 2021-06-01T11:18:20.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-17T21:41:17.000Z (about 2 years ago)
- Last Synced: 2024-10-19T21:27:05.784Z (3 months ago)
- Topics: javascript, nest, nestjs, nodejs, redis, typescript
- Language: TypeScript
- Homepage:
- Size: 152 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Description
Redis is an open source, in-memory data structure store used as a database, cache, message broker, and streaming engine.
You can to use gadin-redis package easily and setup it.
## Usage
### Step 1: Installation
```sh
npm install gadin-redis
```wait for the installation to finish.
### Step 2: Module initialization
You've added below code in your root module:
```ts
@Module({
imports: [
RedisModule.forRoot({
credentials: {
host: 'host',
port: 6379,
username:'user',
password:'pass'
}
})
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {
}
```### Notice
``
The username and password are optional.
``### Step 3: Use in Services
You've to inject RedisClient in your service and use redis methods like below:
```ts
export class AppService{
constructor(@Inject(REDIS) private redis: RedisClient) {
}async test() {
await this.redis.set("key", "value")
}
}```
### Hint
``
Import RedisClinet and REDIS from the gadin-redis
``## Author
[Mohammad Sardari](mailto:[email protected])## License
[MIT License](./LICENCE)