In-memory bounded store of recent prediction results, keyed by opaque IDs that survive a page refresh. Capacity-limited LRU; evicts the oldest entry once capacity is reached.
More...
#include <ServeHandlers.hpp>
In-memory bounded store of recent prediction results, keyed by opaque IDs that survive a page refresh. Capacity-limited LRU; evicts the oldest entry once capacity is reached.
Predictions are kept only in memory; restarting the server clears them. IDs are hex-encoded 64-bit random integers — opaque enough that they don't reveal request counts.
◆ PredictionStore()
| ppforest2::cli::serve::PredictionStore::PredictionStore |
( |
std::size_t | capacity = DEFAULT_CAPACITY | ) |
|
|
explicit |
◆ get()
| std::optional< PredictionResult > ppforest2::cli::serve::PredictionStore::get |
( |
std::string const & | id | ) |
const |
Look up id; returns nullopt if not in the store (evicted or never existed).
◆ put()
| std::string ppforest2::cli::serve::PredictionStore::put |
( |
PredictionResult | result | ) |
|
Store result and return its newly-generated id.
◆ DEFAULT_CAPACITY
| std::size_t ppforest2::cli::serve::PredictionStore::DEFAULT_CAPACITY = 32 |
|
staticconstexpr |
The documentation for this class was generated from the following file: