hpx/cache/entries/fifo_entry.hpp#

Defined in header hpx/cache/entries/fifo_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
template<typename Value>
class fifo_entry : public hpx::util::cache::entries::entry<Value, fifo_entry<Value>>#
#include <hpx/cache/entries/fifo_entry.hpp>

The fifo_entry type can be used to store arbitrary values in a cache. Using this type as the cache’s entry type makes sure that the least recently inserted entries are discarded from the cache first.

Note

The fifo_entry conforms to the CacheEntry concept.

Note

This type can be used to model a ‘last in first out’ cache policy if it is used with a std::greater as the caches’ UpdatePolicy (instead of the default std::less).

Template Parameters

Value – The data type to be stored in a cache. It has to be default constructible, copy constructible and less_than_comparable.

Public Functions

fifo_entry() = default#

Any cache entry has to be default constructible.

inline explicit fifo_entry(Value const &val) noexcept(std::is_nothrow_constructible_v<base_type, Value const&>)#

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

inline explicit fifo_entry(Value &&val) noexcept#

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

inline constexpr bool insert()#

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

Returns

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

inline constexpr time_point const &get_creation_time() const noexcept#

Private Types

using base_type = entry<Value, fifo_entry<Value>>#
using time_point = std::chrono::steady_clock::time_point#

Private Members

time_point insertion_time_#

Friends

inline friend bool operator<(fifo_entry const &lhs, fifo_entry const &rhs) noexcept(noexcept(std::declval<time_point const&>() < std::declval<time_point const&>()))#

Compare the ‘age’ of two entries. An entry is ‘older’ than another entry if it has been created earlier (FIFO).