forked from fuzzland/cached-eth-rpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add caching for eth_blockNumber; fix cache update logic; set eth_max_…
…priority_fee_per_gas to 10s
- Loading branch information
Showing
5 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use crate::rpc_cache_handler::RpcCacheHandler; | ||
use serde_json::Value; | ||
|
||
#[derive(Default, Clone)] | ||
pub struct Handler {} | ||
|
||
impl RpcCacheHandler for Handler { | ||
fn method_name(&self) -> &'static str { | ||
"eth_blockNumber" | ||
} | ||
|
||
fn extract_cache_key(&self, _: &Value) -> anyhow::Result<Option<String>> { | ||
Ok(Some(format!("eth_blockNumber"))) | ||
} | ||
|
||
fn get_ttl(&self) -> u32 { | ||
2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,6 @@ impl RpcCacheHandler for Handler { | |
} | ||
|
||
fn get_ttl(&self) -> u32 { | ||
0 | ||
10 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters