@pwngh/economy-lab
    Preparing search index...

    Function memoryCache

    • Builds an in-process Cache backed by a Map. It exposes the same observable contract as the Redis adapter. The Cache conformance suite runs it as its oracle, the way memoryStore is the reference for the Store. It also serves as a usable single-process cache when no Redis is wired.

      It honors ttlMs against the injected clock. An entry past its expiry reads as a miss, the same way Redis's PX flag expires a key, so the conformance suite can drive expiry with a fake clock. Values are opaque strings, and this never parses them.

      Parameters

      Returns Cache

      const cache = memoryCache();
      await cache.set('bal:usr_42:spendable', 'CREDIT:12.34', 60_000);
      await cache.get('bal:usr_42:spendable'); // 'CREDIT:12.34' | null

      Storage for the cache and store port contracts.