|
NeuralPlus 0.2.0
A small C++17 SDK for AI clients, sessions, tools, and tracing
|
#include <session.hpp>
Public Member Functions | |
| SessionState ()=default | |
| Creates an empty process-local cache. | |
| template<typename T > | |
| void | set (std::string key, T value) |
| Stores or replaces a typed value. | |
| template<typename T > | |
| std::optional< T > | get (std::string_view key) const |
| Returns a copy of a typed value, or no value when the key is absent. | |
| template<typename T , typename UpdateFunction > | |
| T | update (std::string key, T initial_value, UpdateFunction &&update_function) |
| bool | contains (std::string_view key) const |
| Returns whether the cache contains a key. | |
| void | erase (std::string_view key) |
| Removes one cached value. | |
| void | clear () |
| Removes all cached values. | |
Thread-safe, process-local cache associated with one Session.
Values must be copy-constructible and are intentionally not persisted or traced.
|
inline |
Atomically updates one typed value.
The callback runs while the state lock is held. It must not call another SessionState method on this same object.