Class SimpleWindowPartitionCache<K,V>
java.lang.Object
org.apache.storm.windowing.persistence.SimpleWindowPartitionCache<K,V>
- All Implemented Interfaces:
WindowPartitionCache<K,V>
A simple implementation that evicts the largest un-pinned entry from the cache. This works well for caching window partitions since the
access pattern is mostly sequential scans.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from interface org.apache.storm.windowing.persistence.WindowPartitionCache
WindowPartitionCache.Builder<K,V>, WindowPartitionCache.CacheLoader<K, V>, WindowPartitionCache.RemovalCause, WindowPartitionCache.RemovalListener<K, V> -
Method Summary
Modifier and TypeMethodDescriptionasMap()Return aConcurrentMapview of the current entries in the cache.Get value from the cache or load the value.voidinvalidate(K key) Invalidate an entry from the cache.static <K,V> SimpleWindowPartitionCache.SimpleWindowPartitionCacheBuilder<K, V> Get value from the cache or load the value pinning it so that the entry will never get evicted.booleanUnpin an entry from the cache so that it can be a candidate for eviction.
-
Method Details
-
newBuilder
-
get
Description copied from interface:WindowPartitionCacheGet value from the cache or load the value.- Specified by:
getin interfaceWindowPartitionCache<K,V> - Parameters:
key- the key- Returns:
- the value
-
pinAndGet
Description copied from interface:WindowPartitionCacheGet value from the cache or load the value pinning it so that the entry will never get evicted.- Specified by:
pinAndGetin interfaceWindowPartitionCache<K,V> - Parameters:
key- the key- Returns:
- the value
-
unpin
Description copied from interface:WindowPartitionCacheUnpin an entry from the cache so that it can be a candidate for eviction.- Specified by:
unpinin interfaceWindowPartitionCache<K,V> - Parameters:
key- the key- Returns:
- true if the entry was unpinned, false otherwise
-
asMap
Description copied from interface:WindowPartitionCacheReturn aConcurrentMapview of the current entries in the cache.- Specified by:
asMapin interfaceWindowPartitionCache<K,V> - Returns:
- the map of key-values currently cached.
-
invalidate
Description copied from interface:WindowPartitionCacheInvalidate an entry from the cache.- Specified by:
invalidatein interfaceWindowPartitionCache<K,V> - Parameters:
key- the key
-