PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::services::cache Namespace Reference

Classes

struct  cache_config
 Configuration options for the LRU cache. More...
 
struct  cache_stats
 Statistics for cache performance monitoring. More...
 
struct  cached_query_result
 Wrapper for cached query results. More...
 
class  query_cache
 DICOM query result cache with monitoring integration. More...
 
struct  query_cache_config
 Configuration for the query cache. More...
 
class  simple_lru_cache
 Thread-safe LRU cache with TTL support. More...
 

Typedefs

template<typename Value >
using string_lru_cache = simple_lru_cache<std::string, Value>
 String-keyed LRU cache for query results.
 

Functions

query_cacheglobal_query_cache ()
 Get the global query cache instance.
 
bool configure_global_cache (const query_cache_config &config)
 Configure the global query cache.
 

Typedef Documentation

◆ string_lru_cache

template<typename Value >
using kcenon::pacs::services::cache::string_lru_cache = simple_lru_cache<std::string, Value>

String-keyed LRU cache for query results.

Commonly used for caching C-FIND query results where the key is a hash of the query parameters.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/services/cache/query_cache.h, and /home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/services/cache/simple_lru_cache.h.

Definition at line 626 of file simple_lru_cache.h.

Function Documentation

◆ configure_global_cache()

bool kcenon::pacs::services::cache::configure_global_cache ( const query_cache_config & config)

Configure the global query cache.

Must be called before the first access to global_query_cache(). Subsequent calls have no effect.

Parameters
configCache configuration
Returns
true if configuration was applied, false if cache was already initialized
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/services/cache/query_cache.h.

Definition at line 168 of file query_cache.cpp.

168 {
169 // This is a simple check - if init already happened, return false
170 // Not perfectly thread-safe for the pending config, but configure
171 // should be called at startup before any access
172 if (g_query_cache) {
173 return false;
174 }
175 g_pending_config = config;
176 g_config_pending = true;
177 return true;
178}

◆ global_query_cache()

query_cache & kcenon::pacs::services::cache::global_query_cache ( )
nodiscard

Get the global query cache instance.

Returns a singleton instance of the query cache. The cache is initialized with default settings on first access. Use configure_global_cache() to customize settings before first use.

Thread Safety: Thread-safe initialization via Meyer's singleton pattern.

Returns
Reference to the global query cache
Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/services/cache/query_cache.h.

Definition at line 163 of file query_cache.cpp.

163 {
164 std::call_once(g_cache_init_flag, init_global_cache);
165 return *g_query_cache;
166}