Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
dev::eth::CodeSizeCache Class Reference

Simple thread-safe cache to store a mapping from code hash to code size. More...

#include <CodeSizeCache.h>

Public Member Functions

void store (h256 const &_hash, size_t size)
 
bool contains (h256 const &_hash) const
 
size_t get (h256 const &_hash) const
 

Static Public Member Functions

static CodeSizeCacheinstance ()
 

Private Member Functions

void removeRandomElement ()
 Removes a random element from the cache. More...
 

Private Attributes

Mutex x_cache
 
std::map< h256, size_t > m_cache
 

Static Private Attributes

static const size_t c_maxSize = 50000
 

Detailed Description

Simple thread-safe cache to store a mapping from code hash to code size.

If the cache is full, a random element is removed.

Definition at line 36 of file CodeSizeCache.h.

Member Function Documentation

bool dev::eth::CodeSizeCache::contains ( h256 const &  _hash) const
inline

Definition at line 46 of file CodeSizeCache.h.

size_t dev::eth::CodeSizeCache::get ( h256 const &  _hash) const
inline

Definition at line 51 of file CodeSizeCache.h.

static CodeSizeCache& dev::eth::CodeSizeCache::instance ( )
inlinestatic

Definition at line 57 of file CodeSizeCache.h.

Here is the caller graph for this function:

void dev::eth::CodeSizeCache::removeRandomElement ( )
inlineprivate

Removes a random element from the cache.

Definition at line 61 of file CodeSizeCache.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void dev::eth::CodeSizeCache::store ( h256 const &  _hash,
size_t  size 
)
inline

Definition at line 39 of file CodeSizeCache.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

const size_t dev::eth::CodeSizeCache::c_maxSize = 50000
staticprivate

Definition at line 72 of file CodeSizeCache.h.

std::map<h256, size_t> dev::eth::CodeSizeCache::m_cache
private

Definition at line 74 of file CodeSizeCache.h.

Mutex dev::eth::CodeSizeCache::x_cache
mutableprivate

Definition at line 73 of file CodeSizeCache.h.


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