eth-rpc-cache
Version:
A simple cache for Ethereum RPC requests extensible with different caching strategies
20 lines (19 loc) • 611 B
JavaScript
// These methods can be safely cached once the result is obtained.
var methods = [
'eth_chainId',
'eth_getBlockByHash',
'eth_getBlockTransactionCountByHash',
'eth_getRawTransactionByBlockHashAndIndex',
'eth_getRawTransactionByHash',
'eth_getTransactionByBlockHashAndIndex',
'eth_getTransactionByHash',
'eth_getUncleByBlockHashAndIndex',
'eth_getUncleCountByBlockHash',
'net_version',
'web3_sha3' // This one could be calculated here instead of calling the node.
];
export var permanentStrategy = {
maxAge: Infinity,
methods: methods,
name: 'permanent'
};