Skip to content

Commit

Permalink
Merge pull request #162 from teampple/dev
Browse files Browse the repository at this point in the history
레디스 변경사항 반영
  • Loading branch information
wjdtkdgns authored Aug 6, 2023
2 parents d933b21 + 66bac25 commit 48fa194
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ dependencies {
implementation 'io.springfox:springfox-boot-starter:3.0.0'
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
// Redis

implementation 'org.springframework.boot:spring-boot-starter-data-redis'

// AWS
implementation 'io.awspring.cloud:spring-cloud-starter-aws:2.4.2'

Expand Down
5 changes: 0 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
version: "3"

services:
redis:
image: "redis:alpine"
ports:
- "6379:6379"

backend-dev:
image: squirmm/teampple-server-dev:dev
container_name: backend-dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.TimeToLive;
import org.springframework.data.redis.core.index.Indexed;


@Getter
@NoArgsConstructor
@RedisHash(value = "refreshToken", timeToLive = 1000L * 60 * 60 * 24 * 14)
@RedisHash(value = "refreshToken")
public class RefreshToken {
@Id
@Indexed
private String jwtRefreshToken;

private String authKey;

@TimeToLive
private Long ttl;

@Builder
public RefreshToken(String jwtRefreshToken, String authKey) {
this.jwtRefreshToken = jwtRefreshToken;
this.authKey = authKey;
this.ttl = 1000L * 60 * 60 * 24 * 14;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.TimeToLive;
import org.springframework.data.redis.core.index.Indexed;

@Getter
@NoArgsConstructor
@RedisHash(value = "invitation", timeToLive = 7200) // 2시간
@RedisHash(value = "invitation") // 2시간
public class Invitation {
@Id
@Indexed
private String code;

private Long teamId;

@TimeToLive
private Long ttl;

@Builder
public Invitation(String code, Long teamId) {
this.code = code;
this.teamId = teamId;
this.ttl = 7200L;
}
}
3 changes: 2 additions & 1 deletion src/main/java/Backend/teampple/infra/redis/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisKeyValueAdapter;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.data.redis.serializer.StringRedisSerializer;

import java.time.Duration;

@Configuration
@EnableRedisRepositories
@EnableRedisRepositories(enableKeyspaceEvents = RedisKeyValueAdapter.EnableKeyspaceEvents.ON_STARTUP)
public class RedisConfig {

@Value("${spring.redis.host}")
Expand Down

0 comments on commit 48fa194

Please sign in to comment.