Package io.github.dhruv1110.jcachex.impl
Class JITOptimizedCache<K,V>
- java.lang.Object
-
- io.github.dhruv1110.jcachex.impl.base.AbstractCacheBase<K,V>
-
- io.github.dhruv1110.jcachex.impl.base.DataBackedCacheBase<K,V,CacheEntry<V>>
-
- io.github.dhruv1110.jcachex.impl.base.ConcurrentCacheBase<K,V>
-
- io.github.dhruv1110.jcachex.impl.base.OptimizedCacheBase<K,V>
-
- io.github.dhruv1110.jcachex.impl.JITOptimizedCache<K,V>
-
- All Implemented Interfaces:
Cache<K,V>
public final class JITOptimizedCache<K,V> extends OptimizedCacheBase<K,V>
JIT-optimized cache implementation focused on hot path performance. Key optimizations: - Method inlining hints via small methods - Monomorphic call sites - Branch prediction optimization - Minimal object allocation in hot paths - Cache-friendly data structures
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.github.dhruv1110.jcachex.impl.base.OptimizedCacheBase
OptimizedCacheBase.State
-
-
Field Summary
-
Fields inherited from class io.github.dhruv1110.jcachex.impl.base.OptimizedCacheBase
accessBuffer, DEFAULT_DRAIN_INTERVAL_NANOS, DEFAULT_DRAIN_THRESHOLD, FREQUENCY_SKETCH_SIZE, frequencySketch, maintenanceLock, operationState, version, windowTinyLFUStrategy
-
Fields inherited from class io.github.dhruv1110.jcachex.impl.base.ConcurrentCacheBase
currentSize, currentWeight, evictionStrategy, scheduler, STRIPE_COUNT, stripes
-
Fields inherited from class io.github.dhruv1110.jcachex.impl.base.DataBackedCacheBase
data
-
Fields inherited from class io.github.dhruv1110.jcachex.impl.base.AbstractCacheBase
config, hasExpiration, hasMaximumSize, hasMaximumWeight, hitCount, maximumSize, missCount, stats, statsEnabled
-
-
Constructor Summary
Constructors Constructor Description JITOptimizedCache(CacheConfig<K,V> config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected V
doGet(K key)
Override to use JIT-optimized read path.protected void
doPut(K key, V value)
Override to use JIT-optimized write path.protected V
doRemove(K key)
Override to use JIT-optimized remove path.String
getJITMetrics()
Returns JIT-specific performance metrics.protected void
performCustomOptimization()
JIT optimization-specific custom optimization.-
Methods inherited from class io.github.dhruv1110.jcachex.impl.base.OptimizedCacheBase
doClear, drainAccessBuffer, enforceSize, getOperationState, getPerformanceMetrics, getVersion, performPeriodicMaintenance, processAccessRecord, recordAccess, scheduleEviction, scheduleOptimizationTasks, shouldAvoidEvictingNewEntries, shutdown
-
Methods inherited from class io.github.dhruv1110.jcachex.impl.base.ConcurrentCacheBase
cleanupExpiredEntries, createCacheEntry, createCacheEntry, doContainsKey, evictEntries, evictEntries, extractValue, getCurrentWeight, getReadLock, getStripeIndex, getWriteLock, isValidEntry, loadValue, notifyListeners, recordScheduledTask, refreshEntries, scheduleCleanup, scheduleRefresh, size
-
Methods inherited from class io.github.dhruv1110.jcachex.impl.base.DataBackedCacheBase
afterClear, beforeClear, createMapEntry, entries, getDataMap, isValidValue, keys, values
-
Methods inherited from class io.github.dhruv1110.jcachex.impl.base.AbstractCacheBase
clear, clearAsync, config, containsKey, get, getAsync, isEntryExpired, isSizeLimitReached, put, putAsync, recordClearStatistics, recordGetStatistics, recordPutStatistics, recordRemoveStatistics, remove, removeAsync, stats, updateStatsFromCounters, validateKey, validateValue
-
-
-
-
Constructor Detail
-
JITOptimizedCache
public JITOptimizedCache(CacheConfig<K,V> config)
-
-
Method Detail
-
doGet
protected V doGet(K key)
Override to use JIT-optimized read path.- Overrides:
doGet
in classOptimizedCacheBase<K,V>
- Parameters:
key
- the key (already validated)- Returns:
- the value or null if not found/expired
-
doPut
protected void doPut(K key, V value)
Override to use JIT-optimized write path.- Overrides:
doPut
in classOptimizedCacheBase<K,V>
- Parameters:
key
- the key (already validated)value
- the value (already validated)
-
doRemove
protected V doRemove(K key)
Override to use JIT-optimized remove path.- Overrides:
doRemove
in classConcurrentCacheBase<K,V>
- Parameters:
key
- the key (already validated)- Returns:
- the removed value or null if not found
-
performCustomOptimization
protected void performCustomOptimization()
JIT optimization-specific custom optimization.- Overrides:
performCustomOptimization
in classOptimizedCacheBase<K,V>
-
getJITMetrics
public String getJITMetrics()
Returns JIT-specific performance metrics.
-
-