This commit is contained in:
@@ -8,15 +8,15 @@ let client: RedisClientType;
|
||||
*/
|
||||
export default class RedisStorage implements StorageInterface {
|
||||
constructor() {
|
||||
const HOST = process.env.REDIS_HOST || 'localhost';
|
||||
const PORT = process.env.REDIS_PORT || 6379;
|
||||
const HOST = process.env.REDIS_HOST ?? 'localhost';
|
||||
const PORT = process.env.REDIS_PORT ?? 6379;
|
||||
client = createClient({ url: `redis://${HOST}:${PORT}` });
|
||||
client.connect();
|
||||
}
|
||||
|
||||
async hasData(key: string) {
|
||||
const data = await client.json.get(key);
|
||||
return (data ? true : false);
|
||||
return (!!data);
|
||||
}
|
||||
|
||||
async getData<Type>(key: string) {
|
||||
|
||||
Reference in New Issue
Block a user