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 |
|
overridevirtual |
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
Implements data::LedgerCacheInterface.
◆ getDeleted()
std::optional< Blob > data::LedgerCache::getDeleted |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
overridevirtual |
Fetch a recently deleted object by its key and sequence number.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in deleted cache, will return the cached Blob; otherwise nullopt is returned
Implements data::LedgerCacheInterface.
◆ getObjectHitRate()
float data::LedgerCache::getObjectHitRate |
( |
| ) |
const |
|
overridevirtual |
- Returns
- A number representing the success rate of hitting an object in the cache versus missing it.
Implements data::LedgerCacheInterface.
◆ getPredecessor()
std::optional< LedgerObject > data::LedgerCache::getPredecessor |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
overridevirtual |
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
Implements data::LedgerCacheInterface.
◆ getSuccessor()
std::optional< LedgerObject > data::LedgerCache::getSuccessor |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
overridevirtual |
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
Implements data::LedgerCacheInterface.
◆ getSuccessorHitRate()
float data::LedgerCache::getSuccessorHitRate |
( |
| ) |
const |
|
overridevirtual |
- Returns
- A number representing the success rate of hitting a successor in the cache versus missing it.
Implements data::LedgerCacheInterface.
◆ isDisabled()
bool data::LedgerCache::isDisabled |
( |
| ) |
const |
|
overridevirtual |
◆ isFull()
bool data::LedgerCache::isFull |
( |
| ) |
const |
|
overridevirtual |
◆ latestLedgerSequence()
uint32_t data::LedgerCache::latestLedgerSequence |
( |
| ) |
const |
|
overridevirtual |
◆ setDisabled()
void data::LedgerCache::setDisabled |
( |
| ) |
|
|
overridevirtual |
◆ setFull()
void data::LedgerCache::setFull |
( |
| ) |
|
|
overridevirtual |
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).
Implements data::LedgerCacheInterface.
◆ size()
size_t data::LedgerCache::size |
( |
| ) |
const |
|
overridevirtual |
◆ update() [1/2]
Update the cache with new ledger objects.
- Parameters
-
objs | The ledger objects to update cache with |
seq | The sequence to update cache for |
Implements data::LedgerCacheInterface.
◆ update() [2/2]
void data::LedgerCache::update |
( |
std::vector< LedgerObject > const & | objs, |
|
|
uint32_t | seq, |
|
|
bool | isBackground ) |
|
overridevirtual |
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 |
Implements data::LedgerCacheInterface.
◆ waitUntilCacheContainsSeq()
void data::LedgerCache::waitUntilCacheContainsSeq |
( |
uint32_t | seq | ) |
|
|
overridevirtual |
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