userver: multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator > Class Template Reference
Loading...
Searching...
No Matches
multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator > Class Template Reference

#include </data/code/userver/libraries/multi-index-lru/include/userver/multi-index-lru/expirable_container.hpp>

Detailed Description

template<typename Value, typename IndexSpecifierList, typename Allocator>
class multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >

MultiIndex LRU expirable container.

Definition at line 20 of file expirable_container.hpp.

Public Member Functions

 ExpirableContainer (size_t max_size, std::chrono::milliseconds ttl)
 
template<typename... Args>
auto emplace (Args &&... args)
 
bool insert (const Value &value)
 
bool insert (Value &&value)
 
template<typename Tag, typename Key>
auto find (const Key &key)
 
template<typename Tag, typename Key>
auto find_no_update (const Key &key) const
 
template<typename Tag, typename Key>
auto equal_range (const Key &key)
 
template<typename Tag, typename Key>
auto equal_range_no_update (const Key &key) const
 
template<typename Tag, typename Key>
bool contains (const Key &key)
 
template<typename Tag, typename Key>
bool contains_no_update (const Key &key) const
 
template<typename IteratorType>
bool erase (IteratorType it)
 
template<typename Tag, typename Key>
bool erase (const Key &key)
 
std::size_t size () const noexcept
 
bool empty () const noexcept
 
std::size_t capacity () const noexcept
 
void set_capacity (std::size_t new_capacity)
 
void shrink_to_fit ()
 Clears the internal nodes pool.
 
void clear ()
 
template<typename Tag>
auto end ()
 
void cleanup_expired ()
 Removes all expired items from container.
 

Constructor & Destructor Documentation

◆ ExpirableContainer()

template<typename Value, typename IndexSpecifierList, typename Allocator>
multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::ExpirableContainer ( size_t max_size,
std::chrono::milliseconds ttl )
inlineexplicit

Definition at line 22 of file expirable_container.hpp.

Member Function Documentation

◆ capacity()

template<typename Value, typename IndexSpecifierList, typename Allocator>
std::size_t multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::capacity ( ) const
inlinenoexcept

Definition at line 126 of file expirable_container.hpp.

◆ cleanup_expired()

template<typename Value, typename IndexSpecifierList, typename Allocator>
void multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::cleanup_expired ( )
inline

Removes all expired items from container.

Definition at line 143 of file expirable_container.hpp.

◆ clear()

template<typename Value, typename IndexSpecifierList, typename Allocator>
void multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::clear ( )
inline

Removes all elements from the container, leaving the node in an internal pool. The keys and values are not destroyed and are reused on next insertion.

Definition at line 135 of file expirable_container.hpp.

◆ contains()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::contains ( const Key & key)
inline

Definition at line 99 of file expirable_container.hpp.

◆ contains_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::contains_no_update ( const Key & key) const
inline

Definition at line 104 of file expirable_container.hpp.

◆ emplace()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename... Args>
auto multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::emplace ( Args &&... args)
inline

Definition at line 31 of file expirable_container.hpp.

◆ empty()

template<typename Value, typename IndexSpecifierList, typename Allocator>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::empty ( ) const
inlinenoexcept

Definition at line 124 of file expirable_container.hpp.

◆ end()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag>
auto multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::end ( )
inline

Definition at line 138 of file expirable_container.hpp.

◆ equal_range()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
auto multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::equal_range ( const Key & key)
inline

Definition at line 70 of file expirable_container.hpp.

◆ equal_range_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
auto multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::equal_range_no_update ( const Key & key) const
inline

Definition at line 93 of file expirable_container.hpp.

◆ erase() [1/2]

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::erase ( const Key & key)
inline

Removes the key from container, leaving the node in an internal pool. The key and value are not destroyed and are reused on next insertion.

Definition at line 118 of file expirable_container.hpp.

◆ erase() [2/2]

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename IteratorType>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::erase ( IteratorType it)
inline

Removes the it from container, leaving the node in an internal pool. The key and value are not destroyed and are reused on next insertion.

Definition at line 111 of file expirable_container.hpp.

◆ find()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
auto multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::find ( const Key & key)
inline

Definition at line 47 of file expirable_container.hpp.

◆ find_no_update()

template<typename Value, typename IndexSpecifierList, typename Allocator>
template<typename Tag, typename Key>
auto multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::find_no_update ( const Key & key) const
inline

Definition at line 64 of file expirable_container.hpp.

◆ insert() [1/2]

template<typename Value, typename IndexSpecifierList, typename Allocator>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::insert ( const Value & value)
inline

Definition at line 42 of file expirable_container.hpp.

◆ insert() [2/2]

template<typename Value, typename IndexSpecifierList, typename Allocator>
bool multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::insert ( Value && value)
inline

Definition at line 44 of file expirable_container.hpp.

◆ set_capacity()

template<typename Value, typename IndexSpecifierList, typename Allocator>
void multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::set_capacity ( std::size_t new_capacity)
inline

Definition at line 128 of file expirable_container.hpp.

◆ shrink_to_fit()

template<typename Value, typename IndexSpecifierList, typename Allocator>
void multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::shrink_to_fit ( )
inline

Clears the internal nodes pool.

Definition at line 131 of file expirable_container.hpp.

◆ size()

template<typename Value, typename IndexSpecifierList, typename Allocator>
std::size_t multi_index_lru::ExpirableContainer< Value, IndexSpecifierList, Allocator >::size ( ) const
inlinenoexcept

Definition at line 122 of file expirable_container.hpp.


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