13 h1 ^= std::hash<uint64_t> {}(coord) + 0x9e3779b9 + (h1 << 6) + (h1 >> 2);
17 h2 ^= std::hash<uint64_t> {}(coord) + 0x9e3779b9 + (h2 << 6) + (h2 >> 2);
20 return h1 ^ (h2 << 1);
24 : m_max_cache_size(max_size)
30 std::lock_guard<std::recursive_mutex> lock(
m_mutex);
58 std::lock_guard<std::recursive_mutex> lock(
m_mutex, std::adopt_lock);
63 it->second.mark_accessed();
67 }
catch (
const std::exception& e) {
82 std::unique_lock<std::recursive_mutex> lock(
m_mutex, std::try_to_lock);
84 if (!lock.owns_lock()) {
90 }
catch (
const std::exception& e) {
104 seg.
cache = *cache_opt;
113 auto it =
m_cache.find(region);
116 it->second.mark_accessed();
143 auto it = std::ranges::find(
m_lru_list, region);
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
RegionCacheManager(size_t max_size)
std::optional< RegionCache > get_cached_segment(const RegionSegment &segment)
std::optional< RegionSegment > get_segment_with_cache(const RegionSegment &segment)
void cache_segment(const RegionSegment &segment)
std::optional< RegionCache > get_cached_region(const Region ®ion)
std::recursive_mutex m_mutex
void update_lru(const Region ®ion)
std::list< Region > m_lru_list
void evict_lru_if_needed()
void cache_region(const RegionCache &cache)
std::unordered_map< Region, RegionCache, RegionHash > m_cache
std::optional< RegionCache > get_cached_region_internal(const Region ®ion)
@ Runtime
General runtime operations (default fallback)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.
Region source_region
Region this cache corresponds to.
Stores cached data for a region, with metadata for cache management.
std::size_t operator()(const Region ®ion) const
bool is_cached
Flag indicating if data is cached.
Region source_region
Associated region.
RegionCache cache
Multi-channel cached audio data.
Represents a discrete segment of audio data with caching capabilities.
std::vector< uint64_t > end_coordinates
Ending frame index (inclusive)
std::vector< uint64_t > start_coordinates
Starting frame index (inclusive)
Represents a point or span in N-dimensional space.