Cache for an entire ledger.
More...
#include <LedgerCache.hpp>
Cache for an entire ledger.
◆ get()
std::optional< Blob > data::LedgerCache::get |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
Fetch a cached object by its key and sequence number.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in cache, will return the cached Blob; otherwise nullopt is returned
◆ getObjectHitRate()
float data::LedgerCache::getObjectHitRate |
( |
| ) |
const |
- Returns
- A number representing the success rate of hitting an object in the cache versus missing it.
◆ getPredecessor()
std::optional< LedgerObject > data::LedgerCache::getPredecessor |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
Gets a cached predcessor.
Note: This function always returns std::nullopt when isFull() returns false.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in cache, will return the cached predcessor; otherwise nullopt is returned
◆ getSuccessor()
std::optional< LedgerObject > data::LedgerCache::getSuccessor |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
Gets a cached successor.
Note: This function always returns std::nullopt when isFull() returns false.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in cache, will return the cached successor; otherwise nullopt is returned
◆ getSuccessorHitRate()
float data::LedgerCache::getSuccessorHitRate |
( |
| ) |
const |
- Returns
- A number representing the success rate of hitting a successor in the cache versus missing it.
◆ isDisabled()
bool data::LedgerCache::isDisabled |
( |
| ) |
const |
- Returns
- true if the cache is disabled; false otherwise
◆ isFull()
bool data::LedgerCache::isFull |
( |
| ) |
const |
- Returns
- true if the cache has all data for the most recent ledger; false otherwise
◆ latestLedgerSequence()
uint32_t data::LedgerCache::latestLedgerSequence |
( |
| ) |
const |
- Returns
- The latest ledger sequence for which cache is available.
◆ setFull()
void data::LedgerCache::setFull |
( |
| ) |
|
Sets the full flag to true.
This is used when cache loaded in its entirety at startup of the application. This can be either loaded from DB, populated together with initial ledger download (on first run) or downloaded from a peer node (specified in config).
◆ size()
size_t data::LedgerCache::size |
( |
| ) |
const |
- Returns
- The total size of the cache.
◆ update()
void data::LedgerCache::update |
( |
std::vector< LedgerObject > const & | objs, |
|
|
uint32_t | seq, |
|
|
bool | isBackground = false ) |
Update the cache with new ledger objects.
- Parameters
-
objs | The ledger objects to update cache with |
seq | The sequence to update cache for |
isBackground | Should be set to true when writing old data from a background thread |
◆ waitUntilCacheContainsSeq()
void data::LedgerCache::waitUntilCacheContainsSeq |
( |
uint32_t | seq | ) |
|
Waits until the cache contains a specific sequence.
- Parameters
-
seq | The sequence to wait for |
The documentation for this class was generated from the following files:
- /__w/clio/clio/src/data/LedgerCache.hpp
- /__w/clio/clio/src/data/LedgerCache.cpp