Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
data::FetchLedgerCache Class Reference

A simple cache holding one ripple::LedgerHeader to reduce DB lookups. More...

#include <LedgerHeaderCache.hpp>

Classes

struct  CacheEntry
 Struct to store ledger header cache entry and the sequence it belongs to. More...
 

Public Member Functions

void put (CacheEntry const &cacheEntry)
 Put CacheEntry into thread-safe container.
 
std::optional< CacheEntryget () const
 Read CacheEntry from thread-safe container.
 

Detailed Description

A simple cache holding one ripple::LedgerHeader to reduce DB lookups.

Used internally by backend implementations. When a ledger header is fetched via FetchLedgerBySeq (often triggered by RPC commands), the result can be stored here. Subsequent requests for the same ledger sequence can proceed to retrieve the header from this cache, avoiding unnecessary database reads and improving performance.

Member Function Documentation

◆ get()

std::optional< FetchLedgerCache::CacheEntry > data::FetchLedgerCache::get ( ) const

Read CacheEntry from thread-safe container.

Returns
Optional CacheEntry, depending on if it exists in thread-safe container or not.

◆ put()

void data::FetchLedgerCache::put ( CacheEntry const & cacheEntry)

Put CacheEntry into thread-safe container.

Parameters
cacheEntryThe Cache to store into thread-safe container.

The documentation for this class was generated from the following files: