Class CorrIdCache#

Nested Relationships#

Nested Types#

Class Documentation#

class CorrIdCache#

bounded TTL cache of recent inter-daemon replies, keyed by correlation ID

Used by daemons to make command retries idempotent: when a tagged command is received whose correlation ID matches a cached entry, the previously-computed reply is replayed verbatim and the underlying handler is NOT re-invoked. Entries expire after TTL_SECONDS or when the cache reaches MAX_ENTRIES, whichever comes first. The cache is intentionally small and bounded; it guards only against same-second retries by DaemonClient::send.

The stored reply is the daemon’s bare retstring as it would have been written to the wire WITHOUT any correlation ID prefix; the caller is responsible for prepending the prefix on replay.

Public Functions

bool lookup(const std::string &id, std::string &reply_out)#
void insert(const std::string &id, const std::string &reply)#

Public Static Attributes

static constexpr size_t MAX_ENTRIES = 64#

max cached replies per server

static constexpr int TTL_SECONDS = 60#

per-entry lifetime in seconds