|
CatapultServer
v0.5.0.1 (Elephant)
|
A hash cache that holds recently seen hashes. More...

Public Member Functions | |
| RecentHashCache (const chain::TimeSupplier &timeSupplier, const HashCheckOptions &options) | |
| Creates a recent hash cache around timeSupplier and options. More... | |
| size_t | size () const |
| Gets the size of the cache. More... | |
| bool | add (const Hash256 &hash) |
| bool | contains (const Hash256 &hash) const |
Returns true if the cache contains hash, false otherwise. More... | |
Private Member Functions | |
| bool | checkAndUpdateExisting (const Hash256 &hash, const Timestamp &time) |
| void | pruneCache (const Timestamp &time) |
| void | tryAddToCache (const Hash256 &hash, const Timestamp &time) |
Private Attributes | |
| chain::TimeSupplier | m_timeSupplier |
| HashCheckOptions | m_options |
| Timestamp | m_lastPruneTime |
| std::unordered_map< Hash256, Timestamp, utils::ArrayHasher< Hash256 > > | m_cache |
A hash cache that holds recently seen hashes.
| catapult::consumers::RecentHashCache::RecentHashCache | ( | const chain::TimeSupplier & | timeSupplier, |
| const HashCheckOptions & | options | ||
| ) |
Creates a recent hash cache around timeSupplier and options.
| bool catapult::consumers::RecentHashCache::add | ( | const Hash256 & | hash | ) |
Checks if hash is already in the cache and adds it to the cache if it is unknown.

|
private |

| bool catapult::consumers::RecentHashCache::contains | ( | const Hash256 & | hash | ) | const |
Returns true if the cache contains hash, false otherwise.
|
private |


| size_t catapult::consumers::RecentHashCache::size | ( | ) | const |
Gets the size of the cache.
|
private |


|
private |
|
private |
|
private |
|
private |