-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cache SPI and resource serialization #92
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @wzy1935 ! I did a first round of comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @wzy1935 , I've added another batch of comments
Can you also add a test that verifies the behavior of a shared cached? That is, if it has stored a response for a one reverse proxy instance, another proxy instance will not have to contact the backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @wzy1935 ! Some more comments
Can you please rebase this PR? Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @wzy1935 , another batch of reviews
|
||
@Override | ||
public Future<Void> close() { | ||
return Future.succeededFuture(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't talk about clearing the map on close, did we? Would it be necessary in your opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I also think there's no need, but when I called the vertx.createSharedResource()
in ReverseProxy#newCache
, there's a closeFuture
that I don't know how to deal with it.
Maybe you could check if the following would work? I think I should change to this version:
// ReverseProxy#newCache
public Cache newCache(CacheOptions options, Vertx vertx) {
if (options.getShared()) {
CloseFuture closeFuture = new CloseFuture();
return ((VertxInternal) vertx).createSharedResource("__vertx.shared.proxyCache", options.getName(), closeFuture, (cf_) -> {
Cache cache = new CacheImpl(options);
return cache;
});
}
return new CacheImpl(options);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The close future is not bound to anything, neither Vert.x nor the context. Take a look at how Vert.x creates shared http clients, or shared Vert.x SQL Clients, shared Kafka Producers
Closes #67
Updated the cache SPI and added serialization for the
Resource
class.