MaxCache

State history with an audit trail

Record every change to a value, with when, what and why

What is MaxCache?

MaxCache is a thread-safe C++ cache for the history of a value. Each time the value changes it stores a record with the time, the state before, the state after, a reason and an optional detail. You can ask for the current state, the last N changes, or the changes in a time range. Changes can also be announced on the bus.

It lives in the Kevin core engine and is used there to track things like license state.

Core components

TimeSeriesCache<T>

A generic template over any state type. It keeps the most recent 1,000 changes and drops the oldest. A mutex guards every call.

Current state

Read the latest value at any time without walking the history.

Queries

Fetch the last N entries, or the entries between two timestamps.

Change notifications

Register a callback, or publish each change to the event bus when one is available.

Use cases

License Monitoring

Track license validity changes and when they happened, with a reason for each transition.

Device Registry

Record device registration, firmware updates and connectivity changes across a fleet.

Audit logs

Entries are append-only records, so you can show how a value got to where it is.

System diagnostics

Replay state transitions to diagnose failures. Understand the exact sequence of events leading to an issue.

Technical details

TimeSeriesEntry<T>

Immutable state record:

timestamp: uint64_t (Unix seconds)
state_before: T
state_after: T
reason: string
detail: string (optional)

Limits

History: the most recent 1,000 entries per cache
Storage: in memory only, so history does not survive a restart
Concurrency: one mutex per cache

Licensing

MaxCache SDK

Licensed commercially. Get in touch to discuss terms.

Get in touch

Get started

MaxCache is part of the Kevin core engine and is not a separate download. To talk about using it, get in touch.