|
14 | 14 |
|
15 | 15 | public class RediSearchServer implements Closeable {
|
16 | 16 |
|
17 |
| - private static final DockerImageName DOCKER_IMAGE_NAME = RedisStackContainer.DEFAULT_IMAGE_NAME |
18 |
| - .withTag(RedisStackContainer.DEFAULT_TAG); |
19 |
| - private final RedisStackContainer container = new RedisStackContainer(DOCKER_IMAGE_NAME).withEnv("REDISEARCH_ARGS", |
20 |
| - "MAXAGGREGATERESULTS -1"); |
21 |
| - private final AbstractRedisClient client; |
22 |
| - private final StatefulRedisModulesConnection<String, String> connection; |
23 |
| - |
24 |
| - public RediSearchServer() { |
25 |
| - this.container.start(); |
26 |
| - this.client = ClientBuilder.create(RedisURI.create(container.getRedisURI())).cluster(container.isCluster()) |
27 |
| - .build(); |
28 |
| - this.connection = RedisModulesUtils.connection(client); |
29 |
| - } |
30 |
| - |
31 |
| - public String getRedisURI() { |
32 |
| - return container.getRedisURI(); |
33 |
| - } |
34 |
| - |
35 |
| - public AbstractRedisClient getClient() { |
36 |
| - return client; |
37 |
| - } |
38 |
| - |
39 |
| - public StatefulRedisModulesConnection<String, String> getConnection() { |
40 |
| - return connection; |
41 |
| - } |
42 |
| - |
43 |
| - @Override |
44 |
| - public void close() { |
45 |
| - connection.close(); |
46 |
| - client.shutdown(); |
47 |
| - client.getResources().shutdown(); |
48 |
| - container.close(); |
49 |
| - } |
| 17 | + private static final String TAG = "6.2.6-v9"; |
| 18 | + |
| 19 | + private static final DockerImageName DOCKER_IMAGE_NAME = RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(TAG); |
| 20 | + |
| 21 | + private final RedisStackContainer container = new RedisStackContainer(DOCKER_IMAGE_NAME).withEnv("REDISEARCH_ARGS", |
| 22 | + "MAXAGGREGATERESULTS -1"); |
| 23 | + |
| 24 | + private final AbstractRedisClient client; |
| 25 | + |
| 26 | + private final StatefulRedisModulesConnection<String, String> connection; |
| 27 | + |
| 28 | + public RediSearchServer() { |
| 29 | + this.container.start(); |
| 30 | + this.client = ClientBuilder.create(RedisURI.create(container.getRedisURI())).cluster(container.isCluster()).build(); |
| 31 | + this.connection = RedisModulesUtils.connection(client); |
| 32 | + } |
| 33 | + |
| 34 | + public String getRedisURI() { |
| 35 | + return container.getRedisURI(); |
| 36 | + } |
| 37 | + |
| 38 | + public AbstractRedisClient getClient() { |
| 39 | + return client; |
| 40 | + } |
| 41 | + |
| 42 | + public StatefulRedisModulesConnection<String, String> getConnection() { |
| 43 | + return connection; |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public void close() { |
| 48 | + connection.close(); |
| 49 | + client.shutdown(); |
| 50 | + client.getResources().shutdown(); |
| 51 | + container.close(); |
| 52 | + } |
| 53 | + |
50 | 54 | }
|
0 commit comments