Version: 24.3.0

RPC Caching

Written by Roxane Letourneau

The RpcClientCache class aims to improve the performance of dApps built using Taquito by reducing the number of calls made to the RPC.

The constructor of the RpcClientCache class takes a RpcClient instance as a parameter and an optional ttl (time to live). By default, the ttl is 1000 milliseconds.

The RpcClientCache acts as a decorator over the RpcClient instance. The RpcClient responses will be cached for the period defined by the ttl.

import { TezosToolkit } from '@taquito/taquito';
import { RpcClient, RpcClientCache } from '@taquito/rpc';

const rpcClient = new RpcClient('RPC_URL');
const Tezos = new TezosToolkit(new RpcClientCache(rpcClient));