Skip to main content
Caching is always enabled in Blocklight to optimize performance and reduce RPC calls. Configure cache TTL (Time To Live) for each analyzer in analysis configuration.

Cache Strategy

Blocklight uses in-memory caching with configurable TTLs:
  • Contracts: 1 hour TTL (default) - bytecode is immutable, so long cache is safe
  • Transactions: 5 minutes TTL (default) - recent transaction data

Configuration

Configure cache TTLs in config.yaml:
analysis:
  transaction:
    cache_ttl_seconds: 300   # 5 minutes (min: 60, max: 86400)
    
  contract:
    cache_ttl_seconds: 3600  # 1 hour (min: 300, max: 604800)

Performance Impact

Caching significantly reduces RPC calls and improves latency:
  • Contract bytecode: Cached aggressively since contracts are immutable
  • Transaction receipts: Cached for 5 minutes to balance freshness and performance
  • Cache hit rates: Typically 85-95% for contracts in production
Caching is crucial when using array methods and analyzing transaction data, as it prevents redundant RPC calls for the same contract addresses.