ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
CircuitCache.h File Reference

LRU in-process cache for recently created provenance circuit gates. More...

#include "provsql_utils_cpp.h"
#include <optional>
#include <utility>
#include <vector>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/sequenced_index.hpp>
Include dependency graph for CircuitCache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CircuitCacheInfos
 All information stored for a single gate in the circuit cache. More...
 
class  CircuitCache
 Bounded LRU cache mapping gate UUIDs to their CircuitCacheInfos. More...
 

Detailed Description

LRU in-process cache for recently created provenance circuit gates.

Reading gates from the mmap-backed persistent storage is relatively expensive. The CircuitCache stores the most recently created gates in an in-memory Boost multi-index container so that subsequent lookups within the same backend transaction can skip the IPC round-trip to the background worker.

The cache is bounded by a fixed byte budget. When inserting a new gate would exceed the budget the oldest entry (FIFO order) is evicted. Evicted entries must be flushed to the background worker by the caller.

The C-linkage wrapper functions in circuit_cache.h provide the interface used by the C portions of the extension.

Definition in file CircuitCache.h.