Skip to content

Class X402::BSV::TxidStore::Memory

Inherits: Object

In-memory backend suitable for development and single-process deployments. Thread-safe via Monitor. Entries expire after ttl seconds.

NOTE: This store provides no deduplication across OS processes. Production multi-process deployments should use a shared backend.

Constants

DEFAULT_MAX_SIZE

Not documented.

DEFAULT_TTL

Not documented.

Public Instance Methods

initialize(ttl: = DEFAULT_TTL, max_size: = DEFAULT_MAX_SIZE)

  • @param ttl [Integer] seconds before a seen txid expires (default 600)
  • @param max_size [Integer] cap on stored txids (default 10_000)
  • @return [Memory] a new instance of Memory

record_if_unseen!(txid)

Atomically checks and records a txid. Returns true if the txid was new (now recorded). Returns false if already seen (duplicate).