nfx-lrucache 0.1.1
High-performance C++20 thread-safe LRU cache with sliding expiration
Loading...
Searching...
No Matches
nfx::cache::LruCacheOptions Struct Referencefinal

Configuration options for LruCache behavior. More...

#include <nfx/cache/LruCache.h>

Public Member Functions

 LruCacheOptions (std::size_t sizeLimit=0, std::chrono::milliseconds slidingExpiration=std::chrono::hours{ 1 }, std::chrono::milliseconds backgroundCleanupInterval=std::chrono::milliseconds{ 0 })
 Construct LruCacheOptions with specified parameters.
std::size_t sizeLimit () const
 Get the maximum number of cache entries allowed.
std::chrono::milliseconds slidingExpiration () const
 Get the default sliding expiration time.
std::chrono::milliseconds backgroundCleanupInterval () const
 Get the background cleanup interval.

Detailed Description

Configuration options for LruCache behavior.

Definition at line 47 of file LruCache.h.

Constructor & Destructor Documentation

◆ LruCacheOptions()

nfx::cache::LruCacheOptions::LruCacheOptions ( std::size_t sizeLimit = 0,
std::chrono::milliseconds slidingExpiration = std::chrono::hours{ 1 },
std::chrono::milliseconds backgroundCleanupInterval = std::chrono::milliseconds{ 0 } )
inline

Construct LruCacheOptions with specified parameters.

Parameters
sizeLimitMaximum number of entries (0 = unlimited)
slidingExpirationDefault expiration time after last access
backgroundCleanupIntervalInterval for automatic expired entry cleanup (0 = disabled)
Here is the call graph for this function:

Member Function Documentation

◆ backgroundCleanupInterval()

std::chrono::milliseconds nfx::cache::LruCacheOptions::backgroundCleanupInterval ( ) const
inlinenodiscard

Get the background cleanup interval.

Returns
Cleanup interval (0 = disabled)
Note
This function is marked [[nodiscard]] - the return value should not be ignored

◆ sizeLimit()

std::size_t nfx::cache::LruCacheOptions::sizeLimit ( ) const
inlinenodiscard

Get the maximum number of cache entries allowed.

Returns
Size limit (0 = unlimited)
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the caller graph for this function:

◆ slidingExpiration()

std::chrono::milliseconds nfx::cache::LruCacheOptions::slidingExpiration ( ) const
inlinenodiscard

Get the default sliding expiration time.

Returns
Sliding expiration duration after last access
Note
This function is marked [[nodiscard]] - the return value should not be ignored
Here is the caller graph for this function:

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