mirror of
https://github.com/XRPLF/clio.git
synced 2026-08-22 21:20:52 +00:00
fix: Don't cache requests with params (#3113)
`ResponseExpirationCache` is using only `method` (or `command`) as a key, but responses might be different with different params. This may lead to a client getting incorrect response because of caching. This PR fixes it by caching only requests without any additional params.
This commit is contained in:
@@ -141,7 +141,7 @@ public:
|
||||
}
|
||||
|
||||
if (not ctx.isAdmin and responseCache_) {
|
||||
if (auto res = responseCache_->get(ctx.method); res.has_value())
|
||||
if (auto res = responseCache_->get(ctx.method, ctx.params); res.has_value())
|
||||
return Result{*std::move(res)};
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
if (not v) {
|
||||
notifyErrored(ctx.method);
|
||||
} else if (not ctx.isAdmin and responseCache_) {
|
||||
responseCache_->put(ctx.method, v.result->as_object());
|
||||
responseCache_->put(ctx.method, ctx.params, v.result->as_object());
|
||||
}
|
||||
|
||||
return Result{std::move(v)};
|
||||
|
||||
Reference in New Issue
Block a user