NestJS extension library for Redisess
npm install @xnestjs/redisess
# or using yarn
yarn add @xnestjs/redisess
An example of nestjs module that import the @xnestjs/mongodb
// module.ts
import { Module } from '@nestjs/common';
import { RedisessModule } from '@xnestjs/redisess';
const client = new Redis();
@Module({
imports: [
RedisessModule.forRoot({
useValue: {
client,
namespace: 'sessions',
},
}),
],
})
export class MyModule {}
An example of nestjs module that import the @xnestjs/mongodb async
// module.ts
import { Module } from '@nestjs/common';
import { RedisessModule } from '@xnestjs/redisess';
const client = new Redis();
@Module({
imports: [
RedisessModule.forRootAsync({
inject: [ConfigModule],
useFactory: (config: ConfigService) => ({
client,
namespace: config.get('SESSION_NAMESPACE'),
}),
}),
],
})
export class MyModule {}
The library supports configuration through environment variables. Environment variables below is accepted. All environment variables starts with prefix (RMQ_). This can be configured while registering the module.
Environment Variable | Type | Default | Description |
---|---|---|---|
SESSION_NAMESPACE | String | ||
SESSION_TTL | Number | 1800 | Time-To-Live value in seconds |
SESSION_WIPE_INTERVAL | Number | 5000 | Interval in ms to run wipe process |