mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-23 05:05:54 +00:00
disable cache when CacheLoadStyle::NONE (#152)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <backend/SimpleCache.h>
|
||||
namespace Backend {
|
||||
|
||||
uint32_t
|
||||
SimpleCache::latestLedgerSequence() const
|
||||
{
|
||||
@@ -13,6 +14,9 @@ SimpleCache::update(
|
||||
uint32_t seq,
|
||||
bool isBackground)
|
||||
{
|
||||
if (disabled_)
|
||||
return;
|
||||
|
||||
{
|
||||
std::unique_lock lck{mtx_};
|
||||
if (seq > latestSeq_)
|
||||
@@ -82,9 +86,18 @@ SimpleCache::get(ripple::uint256 const& key, uint32_t seq) const
|
||||
return {e->second.blob};
|
||||
}
|
||||
|
||||
void
|
||||
SimpleCache::setDisabled()
|
||||
{
|
||||
disabled_ = true;
|
||||
}
|
||||
|
||||
void
|
||||
SimpleCache::setFull()
|
||||
{
|
||||
if (disabled_)
|
||||
return;
|
||||
|
||||
full_ = true;
|
||||
std::unique_lock lck{mtx_};
|
||||
deletes_.clear();
|
||||
|
||||
Reference in New Issue
Block a user