eclipse-vertx / vertx-http-proxy

vertx http proxy
Eclipse Public License 2.0
53 stars 36 forks source link

Cache storage using Vert.x Redis Client #68

Open tsegismont opened 5 months ago

tsegismont commented 5 months ago

Depends on #67

Storing cached resources in an external system allows for sharing content between several proxy servers.

Redis is popular and we already have a Vert.x Redis Client.

wzy1935 commented 1 month ago

Hi @vietj ,

Through discussion with @tsegismont , we need a new module for this feature (A cache implementation using Redis, probably named vertx-http-proxy-cache-store-redis). To avoid circular dependencies, where do you think we should put it? In the vertx-http-proxy repo or in the vertx-redis-client repo?

Thanks!

tsegismont commented 1 month ago

@wzy1935 in order to use the Vert.x Redis Client test classes in the project, you must add this:

    <dependency>
      <groupId>io.vertx</groupId>
      <artifactId>vertx-redis-client</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
      <version>${project.version}</version>
    </dependency>

Note that the <version>${project.version}</version> element is mandatory because the vertx-redis-client tests jar dependency is not defined in the vertx-dependencies BOM.

And then in your test code you can create/close a client before/after each test:


  @ClassRule
  public static final RedisStandalone redis = RedisStandalone.builder().setVersion("5.0").build();

  private Redis client;

  @Before
  public void before(TestContext should) {
    Async before = should.async();

    client = Redis.createClient(
      vertx,
      new RedisOptions().setConnectionString(redis.getRedisUri()));

    client.connect().onComplete(onConnect -> {
      should.assertTrue(onConnect.succeeded());
      before.complete();
    });
  }

  @After
  public void after() {
    client.close();
  }
tsegismont commented 1 month ago

Hi @vietj ,

Through discussion with @tsegismont , we need a new module for this feature (A cache implementation using Redis, probably named vertx-http-proxy-cache-store-redis). To avoid circular dependencies, where do you think we should put it? In the vertx-http-proxy repo or in the vertx-redis-client repo?

Thanks!

@vietj any requirement or preference regarding this question?