Apache Mesos
Public Types | Public Member Functions | Friends | List of all members
Cache< Key, Value > Class Template Reference

#include <cache.hpp>

Public Types

typedef std::list< Key > list
 
typedef std::unordered_map< Key, std::pair< Value, typename list::iterator > > map
 

Public Member Functions

 Cache (size_t _capacity)
 
void put (const Key &key, const Value &value)
 
Option< Value > get (const Key &key)
 
Option< Value > erase (const Key &key)
 
size_t size () const
 

Friends

std::ostream & operator<< (std::ostream &stream, const Cache< Key, Value > &c)
 

Member Typedef Documentation

template<typename Key, typename Value>
typedef std::list<Key> Cache< Key, Value >::list
template<typename Key, typename Value>
typedef std::unordered_map< Key, std::pair<Value, typename list::iterator> > Cache< Key, Value >::map

Constructor & Destructor Documentation

template<typename Key, typename Value>
Cache< Key, Value >::Cache ( size_t  _capacity)
inlineexplicit

Member Function Documentation

template<typename Key, typename Value>
Option<Value> Cache< Key, Value >::erase ( const Key &  key)
inline
template<typename Key, typename Value>
Option<Value> Cache< Key, Value >::get ( const Key &  key)
inline
template<typename Key, typename Value>
void Cache< Key, Value >::put ( const Key &  key,
const Value &  value 
)
inline
template<typename Key, typename Value>
size_t Cache< Key, Value >::size ( ) const
inline

Friends And Related Function Documentation

template<typename Key, typename Value>
std::ostream& operator<< ( std::ostream &  stream,
const Cache< Key, Value > &  c 
)
friend

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