Class AccessPatternAnalyzer
java.lang.Object
com.loomcache.server.metrics.AccessPatternAnalyzer
Detects and analyzes access patterns in cache operations.
Identifies temporal patterns, distribution types, and bursty behavior.
Thread-safe using ReentrantReadWriteLock.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordAccess record.static final recordDistribution statistics.static enumPattern types detected in access data.static final recordTemporal pattern information. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all recorded accesses.detectPattern(long window) Detect the access pattern type in the given time window.intGet number of recorded accesses.Get key distribution statistics.Get temporal pattern information.intGet number of unique keys accessed.voidrecordAccess(String key, long latencyNs) Record a key access.
-
Constructor Details
-
AccessPatternAnalyzer
public AccessPatternAnalyzer()Create a new AccessPatternAnalyzer.
-
-
Method Details
-
recordAccess
Record a key access.- Parameters:
key- the accessed keylatencyNs- access latency in nanoseconds
-
detectPattern
Detect the access pattern type in the given time window.- Parameters:
window- the time window in milliseconds- Returns:
- detected pattern type
-
getKeyDistribution
Get key distribution statistics.- Returns:
- distribution statistics
-
getTemporalPattern
Get temporal pattern information.- Returns:
- temporal pattern
-
clear
public void clear()Clear all recorded accesses. -
getAccessCount
public int getAccessCount()Get number of recorded accesses.- Returns:
- access count
-
getUniqueKeyCount
public int getUniqueKeyCount()Get number of unique keys accessed.- Returns:
- unique key count
-