issues
search
Transcendence-Animal-Crossing
/
backend
3
stars
0
forks
source link
Key-Value Repository ๊ตฌํ ๋ณ๊ฒฝ | CacheManager -> Redis
#63
Open
sseunghoon
opened
5 months ago
sseunghoon
commented
5 months ago
๐ ์ด์ ๋ด์ฉ
GameRepository | User <-> Game
ClientRepository | User <-> WebSocket Client
RoomRepository | User <-> Room
๐ ์์ธ ๋ด์ฉ
RoomRepository ๋ ์ถํ์ ์ฑํ ๋ฃธ์ด ๋นํ๋ฐ์ฑ์ผ๋ก ๋ณ๊ฒฝ๋๋ค๋ฉด DB๋ก ๊ตฌํ์ฒด๊ฐ ๋ฐ๋ ์ ์์ผ๋ฏ๋ก ๊ฐ์ฅ ๋ง์ง๋ง์ ๋ณ๊ฒฝ
ํค๊ฐ ์๋ฏธ๊ตฌ๋ถ ์ปจ๋ฒค์ ์ '-' ์์ ':' ๋ก ๋ณ๊ฒฝ (ex. user:{userId})
Hashes ์๋ฃ ๊ตฌ์กฐ ์ฌ์ฉ
๐โโ๏ธ ์๋ ผํด๋ด์ผ ํ ๊ฒ
(Game/Client/Room)Repository Interface์ RepositoryImpl๋ฅผ ๋ง๋ค๊ณ interface์ ์์กดํ๋ ํํ๊ฐ ์ด์์ ์ผ๋ก ๋๊ปด์ง๋ค.
๋ํฐ์ฒดํน ๊ธฐ๋ฅ์ด ์๊ธฐ ๋๋ฌธ์ update(room:Room) ํํ์ ํจ์๋ฅผ ๋ง๋ค๊ธฐ ์ด๋ ต๋ค.
updateTitle() ๊ณผ ๊ฐ์ ํจ์๋ฅผ ์ฌ๋ฌ๊ฐ ๋ง๋ค์ด interface์ ๋ฃ๋ ๊ฒ์ด ์ข์ ์ค๊ณ์ธ๊ฐ? (๊ตฌํ์ฒด์ ๋ฃ๋ ๊ฒ์ ํ์คํ ๊ตฌ๋ฆฌ๋ค.)
update(room:Room, {์ ๋ฐ์ดํธ ๋ฉค๋ฒ: any}) ํํ์ ํจ์๋ฅผ interface์ ๋ฃ๊ณ ์ ๋ฐ์ดํธ ๋ฉค๋ฒ์ ํ์ ์ผ๋ก ๊ตฌ๋ณํ ๊น ์๊ฐ๋ ๋ ๋ค. ์ด๋ฅผ ์ํด์๋ title, participants, bannedUsers, invitedUsers, mode, password ๋ชจ๋ ๊ฐ๊ฐ์ ์ํ ํด๋์ค๋ฅผ ๊ตฌํํด์ผ ํ๋ค. Collection ์ ๋ํํ๊ณ title์ ๊ฒฝ์ฐ ์์ค ๊ฒ์ฌ๋ก์ง์ ์ํํ๋ ํด๋์ค๋ฅผ ์์ํ๊ณ ๊ธ์ ์ ํ์ ๊ฒ์ฌํ๋ ๋ฑ์ ๋ก์ง์ ๋ด์ ํด๋์ค๋ฅผ ๋ง๋ค ์๋ ์์ ๊ฒ ๊ฐ๋ค.
๐ ์ฐธ๊ณ ์๋ฃ
Redis ๊ณต์๋ฌธ์
NestJS-์ฃผ๋ฌธ์ฒ๋ฆฌ๊ณผ์ ์-ํตํด-์์๋ณด๋-์์ต๋ฅ -๋ญํน-์กฐํ-Part-4-Redis-Sorted-Set๊ณผ-Ranking
sseunghoon
commented
5 months ago
ํด๋น ์ด์๊ฐ ๋๋๊ณ Clustering ์ ๊ณ ๋ คํ ๊ฒ
๐ ์ด์ ๋ด์ฉ
๐ ์์ธ ๋ด์ฉ
๐โโ๏ธ ์๋ ผํด๋ด์ผ ํ ๊ฒ
๐ ์ฐธ๊ณ ์๋ฃ