Skip to content

Class X402::BSV::NetworkVisibility::Cache

Inherits: Object

Per-gateway positive-only TTL cache keyed by txid.

Protects ARC from duplicate-submission bursts (two near- simultaneous requests with the same proof) without masking genuine propagation. Entries expire after ttl seconds; expired entries are pruned opportunistically on read. Mutex-guarded for multi-threaded Rack deployments.

Constants

DEFAULT_TTL

Not documented.

Public Instance Methods

fetch(txid)

Returns the cached status for txid, or nil if absent or expired. Expired entries are dropped on read.

initialize(ttl: = DEFAULT_TTL)

  • @param ttl [Integer] seconds a positive observation remains fresh
  • @return [Cache] a new instance of Cache

store(txid, status)

Records a positive observation. Callers MUST only store visible statuses — negative results are never cached.