MADNESS  version 0.9
Classes | Static Public Member Functions | List of all members
madness::detail::DistCache< keyT > Class Template Reference

Distributed caching utility. More...

#include <dist_cache.h>

Static Public Member Functions

template<typename valueT >
static void set_cache_value (const keyT &key, const valueT &value)
 Set the cache value accosted with key. More...
 
template<typename valueT >
static void get_cache_value (const keyT &key, madness::Future< valueT > &value)
 Get the cache value accosted with key. More...
 
template<typename valueT >
static madness::Future< valueT > get_cache_value (const keyT &key)
 Get the cache value accosted with key. More...
 

Detailed Description

template<typename keyT>
class madness::detail::DistCache< keyT >

Distributed caching utility.

This object implements a local, key-value caching mechanism that can be used by remote tasks or active messages to move data between processes without synchronization. Because cache values are retrieved via a Future, you can get or set the cache in any order. The first call get_cache_value or set_cache_value or will insert the cache element, and the second call to these functions will remove it. Therefore, set_cache_value and get_cache_value can only be called once each per cache value.

Template Parameters
keyTThe key type of the cache

Member Function Documentation

template<typename keyT >
template<typename valueT >
static void madness::detail::DistCache< keyT >::get_cache_value ( const keyT &  key,
madness::Future< valueT > &  value 
)
inlinestatic

Get the cache value accosted with key.

This will get the value associated with key to value. The value is given in the form of a Future, which is set by a call to set_cache_value. If the cache element does not exist, it is inserted into the cache. Otherwise, it is removed from the cache.

Template Parameters
valueTThe object type that will be used to set the cache
Parameters
[in]keyThe key associated with value
[out]valueThe data that will be cached

References madness::ConcurrentHashMap< keyT, valueT, hashfunT >::erase(), madness::ConcurrentHashMap< keyT, valueT, hashfunT >::insert(), madness::Hash_private::HashAccessor< hashT, lockmode >::release(), and madness::Future< T >::set().

template<typename keyT >
template<typename valueT >
static madness::Future<valueT> madness::detail::DistCache< keyT >::get_cache_value ( const keyT &  key)
inlinestatic

Get the cache value accosted with key.

This will get the value associated with key to value. If the cache element does not exist, it is inserted into the cache. Otherwise, it is removed from the cache.

Template Parameters
valueTThe object type that will be used to set the cache
Parameters
[in]keyThe key associated with value
Returns
A Future that holds/will hold the cache value, which will be set by a call to set_cache_value.

References madness::ConcurrentHashMap< keyT, valueT, hashfunT >::erase(), madness::ConcurrentHashMap< keyT, valueT, hashfunT >::insert(), and madness::Hash_private::HashAccessor< hashT, lockmode >::release().

template<typename keyT >
template<typename valueT >
static void madness::detail::DistCache< keyT >::set_cache_value ( const keyT &  key,
const valueT &  value 
)
inlinestatic

Set the cache value accosted with key.

This will set the value associated with key to value. If the cache element does not exist, it is inserted into the cache. Otherwise, it is removed from the cache.

Template Parameters
valueTThe object type that will be used to set the cache (may be a madness::Future type).
Parameters
keyThe key associated with value
valueThe data that will be cached

References madness::ConcurrentHashMap< keyT, valueT, hashfunT >::erase(), madness::f, madness::ConcurrentHashMap< keyT, valueT, hashfunT >::insert(), madness::Future< T >::probe(), madness::Hash_private::HashAccessor< hashT, lockmode >::release(), and madness::Future< T >::set().


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