hpx/cache/entries/entry.hpp

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace util
namespace cache
namespace entries
class entry
#include <hpx/cache/entries/entry.hpp>

Template Parameters
  • Value: The data type to be stored in a cache. It has to be default constructible, copy constructible and less_than_comparable.

  • Derived: The (optional) type for which this type is used as a base class.

Public Types

using value_type = Value

Public Functions

entry()

Any cache entry has to be default constructible.

entry(value_type const &val)

Construct a new instance of a cache entry holding the given value.

entry(value_type &&val)

Construct a new instance of a cache entry holding the given value.

constexpr bool touch() const

The function touch is called by a cache holding this instance whenever it has been requested (touched).

Note

It is possible to change the entry in a way influencing the sort criteria mandated by the UpdatePolicy. In this case the function should return true to indicate this to the cache, forcing to reorder the cache entries.

Note

This function is part of the CacheEntry concept

Return

This function should return true if the cache needs to update it’s internal heap. Usually this is needed if the entry has been changed by touch() in a way influencing the sort order as mandated by the cache’s UpdatePolicy

constexpr bool insert() const

The function insert is called by a cache whenever it is about to be inserted into the cache.

Note

This function is part of the CacheEntry concept

Return

This function should return true if the entry should be added to the cache, otherwise it should return false.

constexpr bool remove() const

The function remove is called by a cache holding this instance whenever it is about to be removed from the cache.

Note

This function is part of the CacheEntry concept

Return

The return value can be used to avoid removing this instance from the cache. If the value is true it is ok to remove the entry, other wise it will stay in the cache.

constexpr std::size_t get_size() const

Return the ‘size’ of this entry. By default the size of each entry is just one (1), which is sensible if the cache has a limit (capacity) measured in number of entries.

value_type &get()

Get a reference to the stored data value.

Note

This function is part of the CacheEntry concept

constexpr value_type const &get() const

Private Members

value_type value_

Friends

bool operator<(entry const &lhs, entry const &rhs)

Forwarding operator< allowing to compare entries instead of the values.