Sharded Pub/Sub 의 등장From Redis 7.0, sharded Pub/Sub is introduced in which shard channels are assigned to slots by the same algorithm used to assign keys to slots. A shard message must be sent to a node that owns the slot the shard channel is hashed to. The cluster makes sure the published shard messages are forwarded to all nodes in the shard, so clients can subscribe to a shard channel by conn..
Redis
캐싱 캐싱은 어플리케이션의 수행 속도를 향상시키는 데에 큰 도움을 주는 간단하지만 강력한 기술입니다. 이는 일시적인 저장소 역할을 하며, 고성능 데이터 접근을 제공합니다. 프로젝트 생성 먼저 실습할 프로젝트 폴더를 하나 생성합니다. 저는 nestjs-cache로 명명했습니다. 해당 폴더에서 nest cli를 사용하여 새로운 프로젝트를 생성합니다. 사이드 프로젝트에서 패키지 매니저를 yarn으로 쓰고 있어서 yarn을 선택했습니다. 패키지 설치 캐싱에 필요한 패키지를 설치해줍니다. 먼저 cache-manager를 설치합니다. yarn add cache-manager # npm i cache-manager 그후에는 타입을 지정하기 위해 @types/cache-manager를 설치합니다. yarn add -D..
Passport 세션을 내부적으로 처리하여 로그인 기능을 대신 해줍니다. 그냥 로그인도 가능하지만, 카카오·구글·페이스북·애플 등 SNS 계정을 통해 로그인 하고자 할 때, 유용하게 사용할 수 있습니다. 먼저 passport 모듈과 서버 자체적으로 로그인할 때 사용하기 위해 로컬 전략을 사용해야 하므로 passport-local 을 설치해줍니다. npm i passport passport-local 이제 passport를 사용하기 위해 루트 디렉터리에서 passport 폴더를 생성합니다. 그리고 메인 파일인 index.js 파일과 로컬 전략을 작성하기 위해 localStrategy.js 를 생성합니다. 먼저 로컬 전략을 세우기 위해 localStrategy.js 파일에 내용을 작성하겠습니다. 이때의 전략..
connect-redis의 버전이 올라가면 아래의 코드를 사용할 수 없다. const expressSession = require("express-session"); const RedisStore = require("connect-redis")(expressSession); ... app.use( expressSession({ resave: false, saveUninitialized: false, secret: , store: new RedisStore({ url: , logErrors: true, }), }) ); 이제 RedisStore에 client가 반드시 주어져야 하기 때문이다. 그래서 RedisStore에 client를 전해주어야 한다. 그래서 코드를 아래와 같이 수정했다. const exp..