
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@parloa/lib-template
Advanced tools
A NestJS Redis client module with built-in support for Azure Managed Identity authentication and automatic token refresh.
pnpm install @parloa/ts-redis
import { Module } from '@nestjs/common'
import { ConfigModule } from '@nestjs/config'
import { makeRedisModuleMetadata, REDIS_CLIENT } from '@parloa/ts-redis'
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
}),
],
...makeRedisModuleMetadata(REDIS_CLIENT),
})
export class AppModule {}
# Required
REDIS_URL=redis://localhost:6379
# Optional connection settings
REDIS_MAX_RETRIES_PER_REQUEST=3
REDIS_COMMAND_TIMEOUT=5000
REDIS_KEEP_ALIVE=30000
REDIS_SOCKET_TIMEOUT=0
REDIS_MAX_RETRY_DELAY=3000
# Azure Managed Identity (optional)
REDIS_USE_AZURE_IDENTITY_AUTH=false
import { Injectable, Inject } from '@nestjs/common'
import { REDIS_CLIENT } from '@parloa/ts-redis'
import Redis from 'ioredis'
@Injectable()
export class MyService {
constructor(@Inject(REDIS_CLIENT) private readonly redis: Redis) {}
async setValue(key: string, value: string): Promise<void> {
await this.redis.set(key, value)
}
async getValue(key: string): Promise<string | null> {
return this.redis.get(key)
}
}
You can use a custom injection token instead of the default REDIS_CLIENT:
const MY_REDIS = Symbol('MY_REDIS')
@Module({
...makeRedisModuleMetadata(MY_REDIS),
})
export class AppModule {}
To use multiple Redis instances with different configurations, use custom injection tokens and environment variable prefixes:
const INSTANCE_1_REDIS = Symbol('INSTANCE_1_REDIS')
const INSTANCE_2_REDIS = Symbol('INSTANCE_2_REDIS')
@Module({
...makeRedisModuleMetadata(INSTANCE_1_REDIS, 'INSTANCE_1_REDIS'),
...makeRedisModuleMetadata(INSTANCE_2_REDIS, 'INSTANCE_2_REDIS'),
})
export class AppModule {}
Then configure separate environment variables:
INSTANCE_1_REDIS_URL=redis://localhost:6379
INSTANCE_2_REDIS_URL=redis://localhost:6380
The library supports Azure Managed Identity authentication for Azure Redis Cache, which eliminates the need for managing passwords.
REDIS_URL=rediss://your-redis.redis.cache.windows.net:6380
REDIS_USE_AZURE_IDENTITY_AUTH=true
REDIS_TOKEN_REFRESH_BUFFER_MS=300000 # Optional, defaults to 300000 (5 minutes)
This library is maintained by the Conversation Platform team. For questions or support, please reach out to the team.
FAQs
A template for creating Node.js libraries
We found that @parloa/lib-template demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 114 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.