ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
ppforest2::cli::serve::PredictionStore Class Reference

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>

Public Member Functions

 PredictionStore (std::size_t capacity=DEFAULT_CAPACITY)
 
std::optional< PredictionResultget (std::string const &id) const
 Look up id; returns nullopt if not in the store (evicted or never existed).
 
std::string put (PredictionResult result)
 Store result and return its newly-generated id.
 

Static Public Attributes

static constexpr std::size_t DEFAULT_CAPACITY = 32
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PredictionStore()

ppforest2::cli::serve::PredictionStore::PredictionStore ( std::size_t capacity = DEFAULT_CAPACITY)
explicit

Member Function Documentation

◆ 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.

Member Data Documentation

◆ DEFAULT_CAPACITY

std::size_t ppforest2::cli::serve::PredictionStore::DEFAULT_CAPACITY = 32
staticconstexpr

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