From 4bd2b0ac4e2dcd243edc15e9916ebb78a8f4ce1d Mon Sep 17 00:00:00 2001 From: wang1010meng Date: Wed, 13 Nov 2019 18:18:53 +0800 Subject: [PATCH] =?UTF-8?q?redis=20maxheap=E9=85=8D=E7=BD=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/geektime/im/lecture/redis/EmbededRedis.java | 4 +++- src/main/resources/application.yml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/geektime/im/lecture/redis/EmbededRedis.java b/src/main/java/geektime/im/lecture/redis/EmbededRedis.java index b1bb9e8..ef729bf 100644 --- a/src/main/java/geektime/im/lecture/redis/EmbededRedis.java +++ b/src/main/java/geektime/im/lecture/redis/EmbededRedis.java @@ -13,12 +13,14 @@ public class EmbededRedis { @Value("${spring.redis.port}") private int redisPort; + @Value("${spring.redis.maxheap}") + private String maxheap; private RedisServer redisServer; @PostConstruct public void startRedis() throws IOException { - redisServer = new RedisServer(redisPort); + redisServer = RedisServer.builder().setting("maxheap "+maxheap).port(redisPort).setting("bind localhost").build(); redisServer.start(); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fc02114..e7d5eaf 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -21,8 +21,9 @@ spring: ddl-auto: update redis: - host: localhost + host: 127.0.0.1 port: 6379 + maxheap: 200m websocket: connector: