---
title: llarp::util::DecayingHashSet

---

# llarp::util::DecayingHashSet



 [More...](#detailed-description)

## Public Types

|                | Name           |
| -------------- | -------------- |
| using std::chrono::milliseconds | **[Time_t](Classes/structllarp_1_1util_1_1DecayingHashSet.md#using-time-t)**  |

## Public Functions

|                | Name           |
| -------------- | -------------- |
| | **[DecayingHashSet](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-decayinghashset)**(Time_t cacheInterval =1s) |
| size_t | **[Size](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-size)**() const |
| bool | **[Contains](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-contains)**(const Val_t & v) const<br>determine if we have v contained in our decaying hashset  |
| bool | **[Insert](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-insert)**(const Val_t & v, Time_t now =0s)<br>return true if inserted return false if not inserted  |
| void | **[Upsert](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-upsert)**(const Val_t & v)<br>upsert will insert or update a value with time as now  |
| void | **[Decay](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-decay)**(Time_t now =0s)<br>decay hashset entries  |
| Time_t | **[DecayInterval](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-decayinterval)**() const |
| bool | **[Empty](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-empty)**() const |
| void | **[DecayInterval](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-decayinterval)**(Time_t interval) |
| void | **[Remove](Classes/structllarp_1_1util_1_1DecayingHashSet.md#function-remove)**(const Val_t & val) |

## Detailed Description

```cpp
template <typename Val_t ,
typename Hash_t  =std::hash<Val_t>>
struct llarp::util::DecayingHashSet;
```

## Public Types Documentation

### using Time_t

```cpp
using llarp::util::DecayingHashSet< Val_t, Hash_t >::Time_t =  std::chrono::milliseconds;
```


## Public Functions Documentation

### function DecayingHashSet

```cpp
inline DecayingHashSet(
    Time_t cacheInterval =1s
)
```


### function Size

```cpp
inline size_t Size() const
```


### function Contains

```cpp
inline bool Contains(
    const Val_t & v
) const
```

determine if we have v contained in our decaying hashset 

### function Insert

```cpp
inline bool Insert(
    const Val_t & v,
    Time_t now =0s
)
```

return true if inserted return false if not inserted 

### function Upsert

```cpp
inline void Upsert(
    const Val_t & v
)
```

upsert will insert or update a value with time as now 

### function Decay

```cpp
inline void Decay(
    Time_t now =0s
)
```

decay hashset entries 

### function DecayInterval

```cpp
inline Time_t DecayInterval() const
```


### function Empty

```cpp
inline bool Empty() const
```


### function DecayInterval

```cpp
inline void DecayInterval(
    Time_t interval
)
```


### function Remove

```cpp
inline void Remove(
    const Val_t & val
)
```


-------------------------------

Updated on 2023-01-06 at 19:35:06 +0000