proxygen
wangle::CachePersistence< K, V > Class Template Referenceabstract

#include <LRUPersistentCache.h>

Inheritance diagram for wangle::CachePersistence< K, V >:
MockPersistenceLayer wangle::FilePersistenceLayer< K, V >

Public Member Functions

 CachePersistence ()
 
virtual ~CachePersistence ()=default
 
bool persistVersionedData (const folly::dynamic &kvPairs, const CacheDataVersion &version)
 
virtual CacheDataVersion getLastPersistedVersion () const
 
virtual void setPersistedVersion (CacheDataVersion version) noexcept
 
virtual bool persist (const folly::dynamic &kvPairs) noexcept=0
 
virtual folly::Optional< folly::dynamicload () noexcept=0
 
virtual void clear ()=0
 

Private Attributes

CacheDataVersion persistedVersion_
 

Detailed Description

template<typename K, typename V>
class wangle::CachePersistence< K, V >

The underlying persistence layer interface. Implementations may write to file, db, /dev/null, etc.

Definition at line 39 of file LRUPersistentCache.h.

Constructor & Destructor Documentation

template<typename K, typename V>
wangle::CachePersistence< K, V >::CachePersistence ( )
inline
template<typename K, typename V>
virtual wangle::CachePersistence< K, V >::~CachePersistence ( )
virtualdefault

Member Function Documentation

template<typename K, typename V>
virtual void wangle::CachePersistence< K, V >::clear ( )
pure virtual
template<typename K, typename V>
virtual CacheDataVersion wangle::CachePersistence< K, V >::getLastPersistedVersion ( ) const
inlinevirtual

Get the last version of the data that was successfully persisted.

Definition at line 61 of file LRUPersistentCache.h.

References wangle::CachePersistence< K, V >::persistedVersion_.

Referenced by MockPersistenceLayer::getLastPersistedVersionConcrete(), and wangle::LRUPersistentCache< K, V, MutexT >::syncNow().

61  {
62  return persistedVersion_;
63  }
CacheDataVersion persistedVersion_
template<typename K, typename V>
virtual folly::Optional<folly::dynamic> wangle::CachePersistence< K, V >::load ( )
pure virtualnoexcept

Returns a list of key value pairs that are present in this persistence store.

Implemented in MockPersistenceLayer, and wangle::FilePersistenceLayer< K, V >.

Referenced by wangle::CachePersistence< K, V >::setPersistedVersion(), and wangle::LRUPersistentCache< K, V, M >::setSyncOnDestroy().

template<typename K, typename V>
virtual bool wangle::CachePersistence< K, V >::persist ( const folly::dynamic kvPairs)
pure virtualnoexcept
template<typename K, typename V>
bool wangle::CachePersistence< K, V >::persistVersionedData ( const folly::dynamic kvPairs,
const CacheDataVersion version 
)
inline

Persist a folly::dynamic array of key value pairs at the specified version. Returns true if persistence succeeded.

Definition at line 49 of file LRUPersistentCache.h.

References wangle::CachePersistence< K, V >::persist(), wangle::CachePersistence< K, V >::persistedVersion_, and version.

Referenced by wangle::LRUPersistentCache< K, V, MutexT >::syncNow().

50  {
51  auto result = persist(kvPairs);
52  if (result) {
54  }
55  return result;
56  }
ProtocolVersion version
CacheDataVersion persistedVersion_
virtual bool persist(const folly::dynamic &kvPairs) noexcept=0
template<typename K, typename V>
virtual void wangle::CachePersistence< K, V >::setPersistedVersion ( CacheDataVersion  version)
inlinevirtualnoexcept

Force set a persisted version. This is primarily for when a persistence layer acts as the initial source of data for some version tracking cache.

Definition at line 69 of file LRUPersistentCache.h.

References wangle::CachePersistence< K, V >::clear(), wangle::CachePersistence< K, V >::load(), folly::pushmi::__adl::noexcept(), wangle::CachePersistence< K, V >::persist(), wangle::CachePersistence< K, V >::persistedVersion_, and version.

Referenced by MockPersistenceLayer::setPersistedVersionConcrete().

69  {
71  }
ProtocolVersion version
CacheDataVersion persistedVersion_

Member Data Documentation


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