CatapultServer  v0.5.0.1 (Elephant)
catapult::cache::SynchronizedCache< TCache > Class Template Reference

Decorator that synchronizes access to a cache. More...

Inheritance diagram for catapult::cache::SynchronizedCache< TCache >:
Collaboration diagram for catapult::cache::SynchronizedCache< TCache >:

Public Types

using CacheValueType = typename TCache::CacheValueType
 
using CacheViewType = typename TCache::CacheViewType
 
using CacheDeltaType = typename TCache::CacheDeltaType
 
using CacheReadOnlyType = typename TCache::CacheReadOnlyType
 

Public Member Functions

 SynchronizedCache (TCache &&cache)
 Creates a synchronized decorator around cache. More...
 
LockedCacheView< CacheViewTypecreateView () const
 Returns a locked cache view based on this cache. More...
 
LockedCacheDelta< CacheDeltaTypecreateDelta ()
 
LockableCacheDelta< CacheDeltaTypecreateDetachedDelta () const
 
void commit ()
 Commits all pending changes to the underlying storage. More...
 

Protected Member Functions

TCache & cache ()
 Gets a typed reference to the underlying cache. More...
 

Private Attributes

TCache m_cache
 
size_t m_commitCounter
 
std::weak_ptr< detail::CacheViewReadLockPair< CacheDeltaType > > m_pWeakDeltaPair
 
utils::SpinReaderWriterLock m_lock
 

Detailed Description

template<typename TCache>
class catapult::cache::SynchronizedCache< TCache >

Decorator that synchronizes access to a cache.

Member Typedef Documentation

◆ CacheDeltaType

template<typename TCache>
using catapult::cache::SynchronizedCache< TCache >::CacheDeltaType = typename TCache::CacheDeltaType

◆ CacheReadOnlyType

template<typename TCache>
using catapult::cache::SynchronizedCache< TCache >::CacheReadOnlyType = typename TCache::CacheReadOnlyType

◆ CacheValueType

template<typename TCache>
using catapult::cache::SynchronizedCache< TCache >::CacheValueType = typename TCache::CacheValueType

◆ CacheViewType

template<typename TCache>
using catapult::cache::SynchronizedCache< TCache >::CacheViewType = typename TCache::CacheViewType

Constructor & Destructor Documentation

◆ SynchronizedCache()

template<typename TCache>
catapult::cache::SynchronizedCache< TCache >::SynchronizedCache ( TCache &&  cache)
inlineexplicit

Creates a synchronized decorator around cache.

Member Function Documentation

◆ cache()

template<typename TCache>
TCache& catapult::cache::SynchronizedCache< TCache >::cache ( )
inlineprotected

Gets a typed reference to the underlying cache.

Here is the caller graph for this function:

◆ commit()

template<typename TCache>
void catapult::cache::SynchronizedCache< TCache >::commit ( )
inline

Commits all pending changes to the underlying storage.

◆ createDelta()

template<typename TCache>
LockedCacheDelta<CacheDeltaType> catapult::cache::SynchronizedCache< TCache >::createDelta ( )
inline

Returns a locked cache delta based on this cache.

Note
Changes to an attached delta can be committed by calling commit.

◆ createDetachedDelta()

template<typename TCache>
LockableCacheDelta<CacheDeltaType> catapult::cache::SynchronizedCache< TCache >::createDetachedDelta ( ) const
inline

Returns a lockable cache delta based on this cache but without the ability to commit any changes to the original cache.

◆ createView()

template<typename TCache>
LockedCacheView<CacheViewType> catapult::cache::SynchronizedCache< TCache >::createView ( ) const
inline

Returns a locked cache view based on this cache.

Here is the caller graph for this function:

Member Data Documentation

◆ m_cache

template<typename TCache>
TCache catapult::cache::SynchronizedCache< TCache >::m_cache
private

◆ m_commitCounter

template<typename TCache>
size_t catapult::cache::SynchronizedCache< TCache >::m_commitCounter
private

◆ m_lock

template<typename TCache>
utils::SpinReaderWriterLock catapult::cache::SynchronizedCache< TCache >::m_lock
mutableprivate

◆ m_pWeakDeltaPair

template<typename TCache>
std::weak_ptr<detail::CacheViewReadLockPair<CacheDeltaType> > catapult::cache::SynchronizedCache< TCache >::m_pWeakDeltaPair
private

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