一键导入
getting-started
Use when configuring Redis caching in NestJS APIs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when configuring Redis caching in NestJS APIs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when scanning NestJS providers with DiscoveryService-backed utilities.
Use when working with the @wisemen/nestjs-custom-fields package — developer-defined custom fields in NestJS with TypeORM persistence and runtime validation. Covers registering the CustomFieldDefinition entity, authoring definitions with customFieldDefinition(), storing resolved values via @CustomFieldValueColumn(), exposing them through CustomFieldValueDto / @IsCustomFields(), and validating submissions with CustomFieldDefinitionsRepository + validateCustomFieldValues(). Use this whenever a task involves custom field definitions, CustomFieldValue columns, custom-field DTOs, or tenant-scoped field definitions, even if the package is not named explicitly.
Use when defining Typesense collections, collectors, and search queries in NestJS APIs.
Generate PDFs through API2PDF in NestJS. Use when converting HTML or URLs to PDFs in apis.
Use when storing and validating multilingual text in NestJS apis with TypeORM and class-validator.
Use when configuring NATS messaging, subscribers, or the simple NatsClient in NestJS applications.
基于 SOC 职业分类
| name | getting-started |
| description | Use when configuring Redis caching in NestJS APIs. |
Use RedisModule.forRootAsync(...) to register a shared Redis client, then
extend RedisCache for scoped keys and inject RedisClient for reads and
writes.
import { Module } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { captureException } from '@wisemen/opentelemetry'
import { RedisModule } from '@wisemen/nestjs-redis'
@Module({
imports: [RedisModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
url: config.getOrThrow('REDIS_URL'),
pingInterval: config.get('REDIS_PING_INTERVAL'),
ttl: config.get('REDIS_DEFAULT_TTL'),
onClientError: (error) => {
captureException(error)
}
})
})],
exports: [RedisModule]
})
export class DefaultRedisModule {}
import { Injectable } from '@nestjs/common'
import { RedisCache, RedisClient } from '@wisemen/nestjs-redis'
@Injectable()
export class ExampleCache extends RedisCache {
readonly prefix = 'user'
constructor(private readonly redis: RedisClient) {}
async getCachedUser(uuid: UserUuid): Promise<User | null> {
return this.redis.getCachedValue<User>(this.buildCacheKey(uuid))
}
async cacheUser(user: User): Promise<void> {
await this.redis.putCachedValue(this.buildCacheKey(user.uuid), user, 3600)
}
}
Use RedisClient.client only when you need raw Redis commands that the cache
helpers do not cover.