Redis
Redis
๋ ๋ฒ์งธ ๋ด์ฅ ์ ์ก๊ธฐ๋ Redis ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค. ์ด ํธ๋์คํฌํฐ๋ ๊ฒ์(publish)/๊ตฌ๋ (subscribe) ๊ธฐ๋ฅ์ ์ด์ฉํฉ๋๋ค.
Installation
์์ํ๊ธฐ ์ ์ ํ์ํ ํจํค์ง๋ฅผ ์ค์นํด์ผํฉ๋๋ค.
$ npm i --save redis
Overview
TCP ์ ์ก ์ ๋ต์์ Redis pub/sub๋ก ์ ํํ๋ ค๋ฉด createMicroservice()
๋ฉ์๋์ ์ ๋ฌ๋ ์ต์
๊ฐ์ฒด๋ฅผ ๋ณ๊ฒฝํด์ผํฉ๋๋ค.
@@filename(main)
const app = await NestFactory.createMicroservice(ApplicationModule, {
transport: Transport.REDIS,
options: {
url: 'redis://localhost:6379',
},
});
info ํํธ
Transport
์ด๊ฑฐ์๋@nestjs/microservices
ํจํค์ง์์ ๊ฐ์ ธ์ต๋๋ค.
Options
ํธ๋์คํฌํฐ์ ํ๋์ ๊ฒฐ์ ํ๋ ์ฌ๋ฌ ๊ฐ์ง ์ต์ ์ด ์์ต๋๋ค.
url
Connection url
retryAttempts
์ด ์ฐ๊ฒฐ ์๋ ํ์
retryDelay
์ฐ๊ฒฐ ์ฌ์๋ ์ง์ฐ ์๊ฐ(ms)
Last updated
Was this helpful?