Open
Conversation
incr, incrBy, decr, decrBy 메서드를 추가하여 Redis의 증감 연산 지원
elegantcoder
approved these changes
Feb 3, 2026
soomtong
approved these changes
Feb 4, 2026
Contributor
soomtong
left a comment
There was a problem hiding this comment.
이러면 캐시 클라이언트가 아니게 되는게 괜찮을까요? 이름을 바꾸던가 어댑터로 감싸던가 해야겠네요.
이름하고 어댑터가 어떤 말씀인지 잘 모르겠어요, 제가 전체적으로 생각중인 fastcache 의 이슈는, IORedis 커넥션을 옵션만 받아서 스스로 만들어내는 점입니다. 또, 그러면서도 multi 같은 명령은 지원하고 있고(memcached 에는 없는데..), 이것도 cache 역할보다는 큰 것 같고요. 그래서 지금은 wrapper 로써의 역할만 인정하는 중입니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 의 종류는 어떤 것인가요?
수정이 필요하게된 이유가 무엇인가요?
Redis의 기본적인 증감 연산(incr/decr) 기능이 FastCache에서 지원되지 않아, 카운터나 조회수 등을 관리할 때 직접 Redis 클라이언트에 접근해야 하는 불편함이 있었습니다.
무엇을 어떻게 변경했나요?
Redis의 증감 연산을 지원하는 4개의 메서드를 추가했습니다:
incr(key: string): 키의 값을 1 증가incrBy(key: string, increment: number): 키의 값을 지정한 값만큼 증가decr(key: string): 키의 값을 1 감소decrBy(key: string, decrement: number): 키의 값을 지정한 값만큼 감소모든 메서드는 Redis 클라이언트의 incr, incrby, decr, decrby 명령어를 직접 호출하며, 연산 후 값을 반환합니다.
코드 변경을 이해하기 위한 배경지식이 필요하다면 설명 해주세요.
Redis의 INCR/DECR 명령어는 문자열로 저장된 숫자 값을 원자적으로 증가/감소시키는 연산입니다. 키가 존재하지 않으면 0으로 초기화한 후 연산을 수행합니다. 이는 카운터, 조회수, 재고 관리 등에 유용하게 사용됩니다.
디펜던시 변경이 있나요?
없음
어떻게 테스트 하셨나요?
기존에 존재하는 zincrBy 메서드와 동일한 패턴으로 구현되었으며, Redis 클라이언트의 표준 메서드를 직접 호출하는 방식이므로 별도의 테스트 추가 없이 안정성이 보장됩니다.
코드의 실행결과를 볼 수 있는 로그나 이미지가 있다면 첨부해주세요.
해당 없음