Skip to content

Commit 219ebd0

Browse files
committed
cache most webserver queries
1 parent 62b7264 commit 219ebd0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

webserver/src/app.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use crate::appstate::AppState;
2121
use crate::config::AppConfig;
2222
use crate::handler;
2323
use crate::state::common::CommonState;
24+
use crate::utils::cache_forever;
2425

2526
lazy_static! {
2627
static ref HTTP_TIMEOUT: u64 = 60;
@@ -42,17 +43,17 @@ impl ApplicationServer {
4243
Router::new()
4344
.route(
4445
"/commitment-tree",
45-
get(handler::tree::get_commitment_tree),
46+
get(cache_forever(handler::tree::get_commitment_tree)),
4647
)
4748
.route(
4849
"/witness-map",
49-
get(handler::witness_map::get_witness_map),
50+
get(cache_forever(handler::witness_map::get_witness_map)),
5051
)
5152
.route(
5253
"/notes-index",
53-
get(handler::notes_index::get_notes_index),
54+
get(cache_forever(handler::notes_index::get_notes_index)),
5455
)
55-
.route("/tx", get(handler::tx::get_tx))
56+
.route("/tx", get(cache_forever(handler::tx::get_tx)))
5657
.route("/height", get(handler::namada_state::get_latest_height))
5758
.route(
5859
"/block-index",

0 commit comments

Comments
 (0)