24 lines
639 B
TypeScript
24 lines
639 B
TypeScript
import { InjectRedis } from '@liaoliaots/nestjs-redis';
|
|
import { Injectable } from '@nestjs/common';
|
|
import { Redis } from 'ioredis';
|
|
import { IConfigurationRepository } from '../../domain/interfaces/configuration.repository';
|
|
|
|
@Injectable()
|
|
export class RedisConfigurationRepository extends IConfigurationRepository {
|
|
constructor(@InjectRedis() private readonly _redis: Redis) {
|
|
super();
|
|
}
|
|
|
|
async get(key: string): Promise<string> {
|
|
return await this._redis.get(key);
|
|
}
|
|
|
|
async set(key: string, value: string) {
|
|
await this._redis.set(key, value);
|
|
}
|
|
|
|
async del(key: string) {
|
|
await this._redis.del(key);
|
|
}
|
|
}
|