Cache Record#
-
class CacheRecordStore#
Owns complete cache records and their exact-key and record-level LRU indexes.
The store owns host metadata but does not modify ResourcePools references or base/draft lookup indices; those cross-component updates belong to ContextCacheManager. Insertion updates the record map, exact-key index, and LRU as one transaction. An exact duplicate reuses the existing record and promotes it to MRU.
Public Functions
-
explicit CacheRecordStore(int32_t maxRecords)#
-
CacheRecordStore(CacheRecordStore const&) = delete#
-
CacheRecordStore &operator=(CacheRecordStore const&) = delete#
-
CacheRecordStore(CacheRecordStore&&) = delete#
-
CacheRecordStore &operator=(CacheRecordStore&&) = delete#
-
RecordInsertResult insert(CacheRecord record)#
Insert with the strong exception guarantee. An exact duplicate is touched, not replaced. This store does not enforce maxRecords; the manager may hold one transient extra during atomic publication.
-
std::optional<RecordId> find(CacheRecordKey const &key) const#
- std::optional<RecordId> findHybrid(
- HybridCheckpointKey const &key
- std::vector<int32_t> hybridCandidateLengths(
- int32_t inputTokenCount
Ready checkpoint lengths in descending order, excluding exact-input and longer endpoints.
-
CacheRecord const &get(RecordId id) const#
-
bool contains(RecordId id) const noexcept#
-
void setDraftState(RecordId id, std::vector<PageId> draftPagePath)#
Attach coherent draft state to a base-only record without changing base identity or record ownership.
-
void touch(RecordId id)#
-
CacheRecord erase(RecordId id)#
-
std::vector<RecordId> lruToMru() const#
-
size_t size() const noexcept#
-
int32_t maxRecords() const noexcept#
-
explicit CacheRecordStore(int32_t maxRecords)#
-
struct CacheRecordKey#
Exact lookup identity for one published sequence-state checkpoint.
The terminal chained hash plus full-block count identifies one logical endpoint in this runtime-local cache.
-
struct HybridCheckpointKey#
Exact identity of an atomic recurrent checkpoint.
-
template<>
struct hash<trt_edgellm::rt::CacheRecordKey># Public Functions
- inline size_t operator()(
- trt_edgellm::rt::CacheRecordKey const &key
-
template<>
struct hash<trt_edgellm::rt::HybridCheckpointKey># Public Functions
- inline size_t operator()(
- trt_edgellm::rt::HybridCheckpointKey const &key
-
struct CacheRecord#
Complete reusable state retained at one publication endpoint.
A record stores a full base path, an optional equally long coherent draft path, and any recurrent or partial-page snapshots. ContextCacheManager gives each listed resource one cache reference, so evicting a branch releases only that record’s ownership while shared ancestors remain resident through other records.
Public Functions
-
std::vector<ResourceId> resources() const#
-
std::optional<HybridCheckpointKey> hybridKey() const#
Public Members
-
RecordId id = {}#
-
CacheRecordKey key = {}#
-
std::vector<BlockHash> logicalBlockHashes#
-
std::vector<PageId> basePagePath#
-
std::vector<PageId> draftPagePath#
-
std::optional<int32_t> recurrentSnapshotSlot#
-
std::optional<int32_t> partialKvSnapshotSlot#
-
std::optional<int32_t> exactCheckpointLength#
-
std::vector<ResourceId> resources() const#
-
struct RecordInsertResult#