Class AllocationOptimizedCache<K,​V>

  • All Implemented Interfaces:
    Cache<K,​V>

    public final class AllocationOptimizedCache<K,​V>
    extends OptimizedCacheBase<K,​V>
    Allocation-optimized cache implementation that minimizes object allocation overhead. Key optimizations: - Thread-local object pools for frequently created objects - Eliminates boxing/unboxing in critical paths - Reduces intermediate object creation - Reuses objects instead of creating new ones - Zero-allocation hot paths where possible
    • Constructor Detail

      • AllocationOptimizedCache

        public AllocationOptimizedCache​(CacheConfig<K,​V> config)
    • Method Detail

      • createCacheEntry

        protected CacheEntry<V> createCacheEntry​(V value)
        Override to use pooled entry creation for allocation optimization.
        Overrides:
        createCacheEntry in class ConcurrentCacheBase<K,​V>
        Parameters:
        value - the value to wrap
        Returns:
        a new cache entry
      • shutdown

        public void shutdown()
        Override shutdown to clean up thread-local pools.
        Overrides:
        shutdown in class OptimizedCacheBase<K,​V>
      • getAllocationMetrics

        public String getAllocationMetrics()
        Returns allocation-specific performance metrics.