Skip to main content
Manage the local cache that stores transaction data and simulation results.

Usage

erst cache <subcommand> [flags]

Description

Caching improves performance and enables offline analysis by storing:
  • Transaction envelopes and metadata
  • Simulation results and traces
  • Ledger entries and state
  • RPC responses
Cache location: ~/.erst/cache (configurable via ERST_CACHE_DIR environment variable)

Subcommands

  • status - View cache statistics
  • clean - Remove old files using LRU strategy
  • clear - Delete all cached data

status

Display the current cache size, number of cached files, and disk usage statistics.

Usage

erst cache status

Output

Shows:
  • Cache directory path
  • Total cache size (human-readable)
  • Number of cached files
  • Maximum configured size
  • Warning if cache exceeds limit

Example output

Cache directory: /home/user/.erst/cache
Cache size: 145.32 MB
Files cached: 87
Maximum size: 500.00 MB

clean

Remove old cached files using LRU (Least Recently Used) strategy.

Usage

erst cache clean [flags]

Description

This command:
  1. Identifies the oldest cached files based on access time
  2. Prompts for confirmation before deletion (unless --force)
  3. Deletes files until cache size is reduced to 50% of maximum
  4. Reports number of files deleted and space freed

Flags

--force
boolean
default:"false"
Skip confirmation promptAlias: -f
--older-than
int
Remove entries older than N daysOnly applies to RPC cache (SQLite database).
--network
string
Remove entries for a specific networkOptions: testnet, mainnet, futurenetOnly applies to RPC cache.
--all
boolean
default:"false"
Remove all RPC cache entriesOnly applies to RPC cache (SQLite database).

Examples

erst cache clean

clear

Delete all cached files from the cache directory.

Usage

erst cache clear [flags]
This action cannot be undone. All cached transaction data and simulation results will be permanently deleted.

Flags

--force
boolean
default:"false"
Skip confirmation promptAlias: -f

Examples

erst cache clear

Confirmation prompt

Without --force, prompts:
This will delete ALL cached files in /home/user/.erst/cache
Are you sure? (yes/no): 
Type yes or y to confirm.

Cache types

Erst maintains two separate caches:

File cache

Stores transaction and simulation data as files:
  • Location: ~/.erst/cache/
  • Format: JSON and XDR files
  • Managed by: status, clean, clear

RPC cache

Stores RPC responses in SQLite database:
  • Location: ~/.erst/cache.db
  • Format: SQLite database
  • Managed by: clean --older-than, clean --network, clean --all

Performance impact

Caching provides significant performance benefits:
  • Network requests: Avoid repeated RPC calls
  • Simulation: Reuse ledger state for similar transactions
  • Offline mode: Debug without network connectivity
  • Cost reduction: Minimize API usage for rate-limited endpoints
  • session - Manage debugging sessions (separate from cache)
  • debug - Debugging uses cached data when available