티스토리 뷰
업데이트 전, 즉 v9.6.0 이전 버전에서의 redis/go-redis 라이브러리를 사용한다면 개별 해시 키에 대한 만료 기간을 설정할 수 없었으며 이로 인해서 만료 기간을 설정하기 위해 Key의 형태를 Hash_Key=Value와 같이 값을 정의하고 관리했었어야 합니다.
하지만 2024년 7월 20일 공개된 v9.6.0 버전, 또는 그 이후 부터는 개별 해시 키에 대한 만료 기간을 설정할 수 있는 함수가 추가 또는 제공됩니다. 🥳
if err := rdb.HExpire(ctx, key, duration, hashKey).Err(); err != nil {
log.Println("해시 키의 만료기간을 설정하는 과정에서 예외가 발생하였습니다.", err.Error())
return err
}
다음과 같이 HExpire 함수를 호출하여 주어진 해시 키에 대한 만료 기간을 설정할 수 있도록 업데이트 되었습니다, 그 외에도 HExpireAt, HExpireAtWithArgs, HExpireTime, HExpireWithArgs와 같은 함수도 같이 추가되었습니다.
// HExpire - Sets the expiration time for specified fields in a hash in seconds.
// The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields.
// For more information - https://redis.io/commands/hexpire/
HExpire(ctx context.Context, key string, expiration time.Duration, fields ...string) *IntSliceCmd
자세한 내용은 아래 링크를 참고하세요.
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- typescript-preact-webpack
- 안드로이드
- 타입스크립트
- 디자인 패턴
- 객체 지향
- Reflow
- Flutter
- 안드로이드 개발
- 백터 이미지
- webpack
- svg
- 깃허브
- 아이콘 개발
- html-inline-webpack-plugin
- mangler
- 팩토리 메서드
- web
- 아이콘 템플릿
- 무료 svg 툴
- 객체지향
- svg 툴
- JavaScript
- 최적화
- github
- android
- 조건부 타입
- 깃허브 터짐
- TypeScript
- Factory Method
- jetpack compose
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
글 보관함