C++ Server-Side SDK
LaunchDarkly SDK
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
launchdarkly::server_side::data_components::ExpirationTracker Class Reference

Public Types

enum class  TrackState { kFresh , kStale , kNotTracked }
 
using TimePoint = std::chrono::time_point< std::chrono::steady_clock >
 

Public Member Functions

void Add (std::string const &key, TimePoint expiration)
 
void Remove (std::string const &key)
 
TrackState State (std::string const &key, TimePoint current_time) const
 
void Add (DataKind kind, std::string const &key, TimePoint expiration)
 
void Remove (DataKind kind, std::string const &key)
 
TrackState State (DataKind kind, std::string const &key, TimePoint current_time) const
 
void Clear ()
 
std::vector< std::pair< std::optional< DataKind >, std::string > > Prune (TimePoint current_time)
 

Member Enumeration Documentation

◆ TrackState

The state of the key in the tracker.

Enumerator
kFresh 

The key is tracked and the key expiration is in the future.

kStale 

The key is tracked and the expiration is either now or in the past.

kNotTracked 

The key is not being tracked.

Member Function Documentation

◆ Add() [1/2]

void launchdarkly::server_side::data_components::ExpirationTracker::Add ( DataKind  kind,
std::string const &  key,
TimePoint  expiration 
)

Add a scoped key to the tracker. Will use the specified TTL for the kind.

Parameters
kindThe scope (kind) of the key.
keyThe key to track.
expirationThe time that the key expires.

◆ Add() [2/2]

void launchdarkly::server_side::data_components::ExpirationTracker::Add ( std::string const &  key,
TimePoint  expiration 
)

Add an unscoped key to the tracker.

Parameters
keyThe key to track.
expirationThe time that the key expires. used.

◆ Clear()

void launchdarkly::server_side::data_components::ExpirationTracker::Clear ( )

Stop tracking all keys.

◆ Prune()

std::vector< std::pair< std::optional< DataKind >, std::string > > launchdarkly::server_side::data_components::ExpirationTracker::Prune ( TimePoint  current_time)

Prune expired keys from the tracker.

Parameters
current_timeThe current time.
Returns
A list of all the kinds and associated keys that expired. Unscoped keys will have std::nullopt as the kind.

◆ Remove() [1/2]

void launchdarkly::server_side::data_components::ExpirationTracker::Remove ( DataKind  kind,
std::string const &  key 
)

Remove a scoped key from the tracker.

Parameters
kindThe scope (kind) of the key.
keyThe key to stop tracking.

◆ Remove() [2/2]

void launchdarkly::server_side::data_components::ExpirationTracker::Remove ( std::string const &  key)

Remove an unscoped key from the tracker.

Parameters
keyThe key to stop tracking.

◆ State() [1/2]

ExpirationTracker::TrackState launchdarkly::server_side::data_components::ExpirationTracker::State ( DataKind  kind,
std::string const &  key,
TimePoint  current_time 
) const

Check the state of a scoped key.

Parameters
kindThe scope (kind) of the key.
keyThe key to check.
Returns
The state of the key.

◆ State() [2/2]

ExpirationTracker::TrackState launchdarkly::server_side::data_components::ExpirationTracker::State ( std::string const &  key,
TimePoint  current_time 
) const

Check the state of an unscoped key.

Parameters
keyThe key to check.
current_timeThe current time.
Returns
The state of the key.

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