rippled
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex > Class Template Reference

Map/cache combination. More...

#include <TaggedCache.h>

Collaboration diagram for xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >:
Collaboration graph
[legend]

Classes

class  KeyOnlyEntry
 
struct  Stats
 
class  ValueEntry
 

Public Types

using mutex_type = Mutex
 
using key_type = Key
 
using mapped_type = T
 
using clock_type = beast::abstract_clock< std::chrono::steady_clock >
 
using shared_weak_combo_pointer_type = SharedWeakUnionPointerType
 
using shared_pointer_type = SharedPointerType
 
using SweptPointersVector = std::vector< SharedWeakUnionPointerType >
 

Public Member Functions

 TaggedCache (std::string const &name, int size, clock_type::duration expiration, clock_type &clock, beast::Journal journal, beast::insight::Collector::ptr const &collector=beast::insight::NullCollector::New())
 
clock_typeclock ()
 Return the clock associated with the cache.
 
std::size_t size () const
 Returns the number of items in the container.
 
int getCacheSize () const
 
int getTrackSize () const
 
float getHitRate ()
 
void clear ()
 
void reset ()
 
template<class KeyComparable >
bool touch_if_exists (KeyComparable const &key)
 Refresh the last access time on a key if present.
 
void sweep ()
 
bool del (key_type const &key, bool valid)
 
template<class R >
bool canonicalize (key_type const &key, SharedPointerType &data, R &&replaceCallback)
 Replace aliased objects with originals.
 
bool canonicalize_replace_cache (key_type const &key, SharedPointerType const &data)
 
bool canonicalize_replace_client (key_type const &key, SharedPointerType &data)
 
SharedPointerType fetch (key_type const &key)
 
template<class ReturnType = bool>
auto insert (key_type const &key, T const &value) -> std::enable_if_t<!IsKeyCache, ReturnType >
 Insert the element into the container.
 
template<class ReturnType = bool>
auto insert (key_type const &key) -> std::enable_if_t< IsKeyCache, ReturnType >
 
bool retrieve (key_type const &key, T &data)
 
mutex_typepeekMutex ()
 
std::vector< key_typegetKeys () const
 
double rate () const
 Returns the fraction of cache hits.
 
template<class Handler >
SharedPointerType fetch (key_type const &digest, Handler const &h)
 Fetch an item from the cache.
 

Private Types

typedef std::conditional< IsKeyCache, KeyOnlyEntry, ValueEntry >::type Entry
 
using KeyOnlyCacheType = hardened_partitioned_hash_map< key_type, KeyOnlyEntry, Hash, KeyEqual >
 
using KeyValueCacheType = hardened_partitioned_hash_map< key_type, ValueEntry, Hash, KeyEqual >
 
using cache_type = hardened_partitioned_hash_map< key_type, Entry, Hash, KeyEqual >
 

Private Member Functions

SharedPointerType initialFetch (key_type const &key, std::lock_guard< mutex_type > const &l)
 
void collect_metrics ()
 
std::thread sweepHelper (clock_type::time_point const &when_expire, clock_type::time_point const &now, typename KeyValueCacheType::map_type &partition, SweptPointersVector &stuffToSweep, std::atomic< int > &allRemovals, std::lock_guard< std::recursive_mutex > const &)
 
std::thread sweepHelper (clock_type::time_point const &when_expire, clock_type::time_point const &now, typename KeyOnlyCacheType::map_type &partition, SweptPointersVector &, std::atomic< int > &allRemovals, std::lock_guard< std::recursive_mutex > const &)
 

Private Attributes

beast::Journal m_journal
 
clock_typem_clock
 
Stats m_stats
 
mutex_type m_mutex
 
std::string m_name
 
int const m_target_size
 
clock_type::duration const m_target_age
 
int m_cache_count
 
cache_type m_cache
 
std::uint64_t m_hits
 
std::uint64_t m_misses
 

Detailed Description

template<class Key, class T, bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
class xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >

Map/cache combination.

This class implements a cache and a map. The cache keeps objects alive in the map. The map allows multiple code paths that reference objects with the same tag to get the same actual object.

So long as data is in the cache, it will stay in memory. If it stays in memory even after it is ejected from the cache, the map will track it.

Note
Callers must not modify data objects that are stored in the cache unless they hold their own lock over all cache operations.

Definition at line 41 of file TaggedCache.h.

Member Typedef Documentation

◆ mutex_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::mutex_type = Mutex

Definition at line 44 of file TaggedCache.h.

◆ key_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::key_type = Key

Definition at line 45 of file TaggedCache.h.

◆ mapped_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::mapped_type = T

Definition at line 46 of file TaggedCache.h.

◆ clock_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::clock_type = beast::abstract_clock<std::chrono::steady_clock>

Definition at line 47 of file TaggedCache.h.

◆ shared_weak_combo_pointer_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::shared_weak_combo_pointer_type = SharedWeakUnionPointerType

Definition at line 48 of file TaggedCache.h.

◆ shared_pointer_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::shared_pointer_type = SharedPointerType

Definition at line 49 of file TaggedCache.h.

◆ SweptPointersVector

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::SweptPointersVector = std::vector<SharedWeakUnionPointerType>

Definition at line 91 of file TaggedCache.h.

◆ Entry

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
typedef std::conditional<IsKeyCache,KeyOnlyEntry,ValueEntry>::type xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::Entry
private

Definition at line 251 of file TaggedCache.h.

◆ KeyOnlyCacheType

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::KeyOnlyCacheType = hardened_partitioned_hash_map<key_type, KeyOnlyEntry, Hash, KeyEqual>
private

Definition at line 253 of file TaggedCache.h.

◆ KeyValueCacheType

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::KeyValueCacheType = hardened_partitioned_hash_map<key_type, ValueEntry, Hash, KeyEqual>
private

Definition at line 255 of file TaggedCache.h.

◆ cache_type

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
using xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::cache_type = hardened_partitioned_hash_map<key_type, Entry, Hash, KeyEqual>
private

Definition at line 257 of file TaggedCache.h.

Constructor & Destructor Documentation

◆ TaggedCache()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::TaggedCache ( std::string const &  name,
int  size,
clock_type::duration  expiration,
clock_type clock,
beast::Journal  journal,
beast::insight::Collector::ptr const &  collector = beast::insight::NullCollector::New() 
)

Member Function Documentation

◆ clock()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
clock_type & xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::clock ( )

Return the clock associated with the cache.

◆ size()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::size_t xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::size ( ) const

Returns the number of items in the container.

◆ getCacheSize()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
int xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::getCacheSize ( ) const

◆ getTrackSize()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
int xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::getTrackSize ( ) const

◆ getHitRate()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
float xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::getHitRate ( )

◆ clear()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
void xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::clear ( )

◆ reset()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
void xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::reset ( )

◆ touch_if_exists()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
template<class KeyComparable >
bool xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::touch_if_exists ( KeyComparable const &  key)

Refresh the last access time on a key if present.

Returns
true If the key was found.

◆ sweep()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
void xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::sweep ( )

◆ del()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
bool xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::del ( key_type const &  key,
bool  valid 
)

◆ canonicalize()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
template<class R >
bool xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::canonicalize ( key_type const &  key,
SharedPointerType &  data,
R &&  replaceCallback 
)

Replace aliased objects with originals.

Due to concurrency it is possible for two separate objects with the same content and referring to the same unique "thing" to exist. This routine eliminates the duplicate and performs a replacement on the callers shared pointer if needed.

Parameters
keyThe key corresponding to the object
dataA shared pointer to the data corresponding to the object.
replaceFunction that decides if cache should be replaced
Returns
true If the key already existed.

◆ canonicalize_replace_cache()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
bool xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::canonicalize_replace_cache ( key_type const &  key,
SharedPointerType const &  data 
)

◆ canonicalize_replace_client()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
bool xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::canonicalize_replace_client ( key_type const &  key,
SharedPointerType &  data 
)

◆ fetch() [1/2]

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
SharedPointerType xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::fetch ( key_type const &  key)

◆ insert() [1/2]

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
template<class ReturnType = bool>
auto xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::insert ( key_type const &  key,
T const &  value 
) -> std::enable_if_t<!IsKeyCache, ReturnType >

Insert the element into the container.

If the key already exists, nothing happens.

Returns
true If the element was inserted

◆ insert() [2/2]

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
template<class ReturnType = bool>
auto xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::insert ( key_type const &  key) -> std::enable_if_t< IsKeyCache, ReturnType >

◆ retrieve()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
bool xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::retrieve ( key_type const &  key,
T &  data 
)

◆ peekMutex()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
mutex_type & xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::peekMutex ( )

◆ getKeys()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::vector< key_type > xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::getKeys ( ) const

◆ rate()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
double xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::rate ( ) const

Returns the fraction of cache hits.

◆ fetch() [2/2]

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
template<class Handler >
SharedPointerType xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::fetch ( key_type const &  digest,
Handler const &  h 
)

Fetch an item from the cache.

If the digest was not found, Handler will be called with this signature: std::shared_ptr<SLE const>(void)

◆ initialFetch()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
SharedPointerType xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::initialFetch ( key_type const &  key,
std::lock_guard< mutex_type > const &  l 
)
private

◆ collect_metrics()

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
void xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::collect_metrics ( )
private

◆ sweepHelper() [1/2]

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::thread xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::sweepHelper ( clock_type::time_point const &  when_expire,
clock_type::time_point const &  now,
typename KeyValueCacheType::map_type partition,
SweptPointersVector stuffToSweep,
std::atomic< int > &  allRemovals,
std::lock_guard< std::recursive_mutex > const &   
)
private

◆ sweepHelper() [2/2]

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::thread xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::sweepHelper ( clock_type::time_point const &  when_expire,
clock_type::time_point const &  now,
typename KeyOnlyCacheType::map_type partition,
SweptPointersVector ,
std::atomic< int > &  allRemovals,
std::lock_guard< std::recursive_mutex > const &   
)
private

Member Data Documentation

◆ m_journal

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
beast::Journal xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_journal
private

Definition at line 277 of file TaggedCache.h.

◆ m_clock

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
clock_type& xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_clock
private

Definition at line 278 of file TaggedCache.h.

◆ m_stats

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
Stats xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_stats
private

Definition at line 279 of file TaggedCache.h.

◆ m_mutex

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
mutex_type xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_mutex
mutableprivate

Definition at line 281 of file TaggedCache.h.

◆ m_name

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::string xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_name
private

Definition at line 284 of file TaggedCache.h.

◆ m_target_size

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
int const xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_target_size
private

Definition at line 287 of file TaggedCache.h.

◆ m_target_age

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
clock_type::duration const xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_target_age
private

Definition at line 290 of file TaggedCache.h.

◆ m_cache_count

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
int xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_cache_count
private

Definition at line 293 of file TaggedCache.h.

◆ m_cache

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
cache_type xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_cache
private

Definition at line 294 of file TaggedCache.h.

◆ m_hits

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::uint64_t xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_hits
private

Definition at line 295 of file TaggedCache.h.

◆ m_misses

template<class Key , class T , bool IsKeyCache = false, class SharedWeakUnionPointerType = SharedWeakCachePointer<T>, class SharedPointerType = std::shared_ptr<T>, class Hash = hardened_hash<>, class KeyEqual = std::equal_to<Key>, class Mutex = std::recursive_mutex>
std::uint64_t xrpl::TaggedCache< Key, T, IsKeyCache, SharedWeakUnionPointerType, SharedPointerType, Hash, KeyEqual, Mutex >::m_misses
private

Definition at line 296 of file TaggedCache.h.