MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ cache_region_if_needed()

void MayaFlux::Kakshya::RegionProcessorBase::cache_region_if_needed ( const RegionSegment segment,
const std::shared_ptr< SignalSourceContainer > &  container 
)
protectedvirtual

Cache a region's data if beneficial and not already cached.

Uses heuristics (e.g., segment size vs. cache size) to decide.

Parameters
segmentThe region segment to consider for caching.
containerThe container providing the data.

Definition at line 33 of file RegionProcessorBase.cpp.

34{
36 return;
37
38 if (m_cache_manager->get_cached_segment(segment)) {
39 return;
40 }
41
42 uint64_t segment_size = segment.get_total_elements();
43 if (segment_size <= m_max_cache_size / 10) { // Use max 10% of cache per segment
44 try {
45 RegionCache cache;
46 cache.data = container->get_region_data(segment.source_region);
47 cache.source_region = segment.source_region;
48 cache.load_time = std::chrono::steady_clock::now();
49
50 m_cache_manager->cache_region(cache);
51 } catch (const std::exception& e) {
52 // Silently fail caching - not critical
53 }
54 }
55}
std::unique_ptr< RegionCacheManager > m_cache_manager

References MayaFlux::Kakshya::RegionCache::data, MayaFlux::Kakshya::RegionSegment::get_total_elements(), MayaFlux::Kakshya::RegionCache::load_time, m_auto_caching, m_cache_manager, m_max_cache_size, MayaFlux::Kakshya::RegionCache::source_region, and MayaFlux::Kakshya::RegionSegment::source_region.

Referenced by MayaFlux::Kakshya::RegionOrganizationProcessor::add_segment_to_region(), and MayaFlux::Kakshya::RegionOrganizationProcessor::organize_group().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: