Expand description

ThreadCache - A per-thread cache with transactional behaviour.

This provides a per-thread cache, which uses a broadcast invalidation queue to manage local content. This is similar to how a CPU cache works in hardware. Generally this is best for small, distinct caches with very few changes / writes.

It’s worth noting that each thread needs to frequently “read” it’s cache. Any idle thread will end up with invalidations building up, that can consume a large volume of memory. This means you need your “readers” to have transactions opened/closed periodically to ensure that invalidations are acknowledged.

Generally you should prefer to use ARCache over this module unless you really require the properties of this module.

Structs

An instance of a threads local cache store.

A read transaction of this cache. During a read, it is guaranteed that the content of this cache will not be updated or invalidated unless by this threads actions.

A write transaction over this local threads cache. If you hold the write txn, no other thread can be in the write state. Changes to this cache will be broadcast to other threads to ensure they can revalidate their content correctly.