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

#include <PersistentCache.h>

Inheritance diagram for wangle::PersistentCache< K, V >:
wangle::LRUPersistentCache< K, V, M > wangle::FilePersistentCache< K, V, M > wangle::LRUPersistentCache< K, V, MutexT > wangle::MockPersistentCache< K, V >

Public Member Functions

virtual ~PersistentCache ()
 
virtual folly::Optional< V > get (const K &key)=0
 
virtual void put (const K &key, const V &val)=0
 
virtual bool remove (const K &key)=0
 
virtual void clear (bool clearPersistence=false)=0
 
virtual size_t size ()=0
 

Detailed Description

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

Interface for a persistent cache that backs up the cache on storage so that it can be reused. This desribes just the key operations common to any cache. Loading from and syncing to the storage is in the actual implementation of the class and the clients should not have to worry about it.

Definition at line 31 of file PersistentCache.h.

Constructor & Destructor Documentation

template<typename K , typename V >
virtual wangle::PersistentCache< K, V >::~PersistentCache ( )
inlinevirtual

Member Function Documentation

template<typename K , typename V >
virtual void wangle::PersistentCache< K, V >::clear ( bool  clearPersistence = false)
pure virtual
template<typename K , typename V >
virtual folly::Optional<V> wangle::PersistentCache< K, V >::get ( const K &  key)
pure virtual

Get a value corresponding to a key

Parameters
keystring, the key to lookup
Returns
value associated with key

Implemented in wangle::LRUPersistentCache< K, V, MutexT >, wangle::LRUPersistentCache< K, V, M >, and wangle::FilePersistentCache< K, V, M >.

template<typename K , typename V >
virtual void wangle::PersistentCache< K, V >::put ( const K &  key,
const V &  val 
)
pure virtual

Set a value corresponding to a key

Parameters
keystring, the key to set
valstring, the value to set

overwrites value if key has a value associated in the cache

Implemented in wangle::LRUPersistentCache< K, V, MutexT >, wangle::LRUPersistentCache< K, V, M >, and wangle::FilePersistentCache< K, V, M >.

Referenced by wangle::PersistentCache< K, V >::~PersistentCache().

template<typename K , typename V >
virtual bool wangle::PersistentCache< K, V >::remove ( const K &  key)
pure virtual

Clear a cache entry associated with a key

Parameters
keystring, the key to lookup and clear
Returns
boolean true if any elements are removed, else false

Implemented in wangle::LRUPersistentCache< K, V, MutexT >, wangle::LRUPersistentCache< K, V, M >, and wangle::FilePersistentCache< K, V, M >.

template<typename K , typename V >
virtual size_t wangle::PersistentCache< K, V >::size ( )
pure virtual

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