---
title: llarp/layers/flow/name_cache.hpp

---

# llarp/layers/flow/name_cache.hpp



## Namespaces

| Name           |
| -------------- |
| **[llarp](Namespaces/namespacellarp.md)** <br>[crypto.hpp] |
| **[llarp::layers](Namespaces/namespacellarp_1_1layers.md)**  |
| **[llarp::layers::flow](Namespaces/namespacellarp_1_1layers_1_1flow.md)**  |

## Classes

|                | Name           |
| -------------- | -------------- |
| class | **[llarp::layers::flow::NameCache](Classes/classllarp_1_1layers_1_1flow_1_1NameCache.md)** <br>cache for in network names (ONS records) with static TTL.  |




## Source code

```cpp
#pragma once

#include "flow_addr.hpp"
#include <llarp/util/decaying_hashtable.hpp>

namespace llarp::layers::flow
{
  class NameCache
  {
    util::DecayingHashTable<std::string, FlowAddr> _names;

   public:
    NameCache(std::chrono::seconds ttl = 5min);

    std::optional<FlowAddr>
    get(std::string name);

    void
    put(std::string name, FlowAddr addr);
  };
}  // namespace llarp::layers::flow
```


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

Updated on 2023-03-06 at 20:36:34 +0000
