Package org.apache.storm.windowing.persistence

# Interface WindowPartitionCache<K,V>

Type Parameters:
  `K` - the key type
  `V` - the value type

All Known Implementing Classes:
  `SimpleWindowPartitionCache`

public interface WindowPartitionCache<K,V>
A loading cache abstraction for caching `WindowState.WindowPartition`.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `WindowPartitionCache.Builder<K,V>`
  Builder interface for `WindowPartitionCache`.
  `static interface`
  `WindowPartitionCache.CacheLoader<K,V>`
  The interface for loading entires into the cache.
  `static enum`
  `WindowPartitionCache.RemovalCause`
  The reason why an enrty got evicted from the cache.
  `static interface`
  `WindowPartitionCache.RemovalListener<K,V>`
  A callback interface for handling removal of events from the cache.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ConcurrentMap<K,V>`
  `asMap()`
  Return a `ConcurrentMap` view of the current entries in the cache.
  `V`
  `get(K key)`
  Get value from the cache or load the value.
  `void`
  `invalidate(K key)`
  Invalidate an entry from the cache.
  `V`
  `pinAndGet(K key)`
  Get value from the cache or load the value pinning it so that the entry will never get evicted.
  `boolean`
  `unpin(K key)`
  Unpin an entry from the cache so that it can be a candidate for eviction.

- ## Method Details

  - ### get

    V get(K key)
    Get value from the cache or load the value.
    Parameters:
      `key` - the key
    Returns:
      the value

  - ### pinAndGet

    V pinAndGet(K key)
    Get value from the cache or load the value pinning it so that the entry will never get evicted.
    Parameters:
      `key` - the key
    Returns:
      the value

  - ### unpin

    boolean unpin(K key)
    Unpin an entry from the cache so that it can be a candidate for eviction.
    Parameters:
      `key` - the key
    Returns:
      true if the entry was unpinned, false otherwise

  - ### asMap

    ConcurrentMap<K,V> asMap()
    Return a `ConcurrentMap` view of the current entries in the cache.
    Returns:
      the map of key-values currently cached.

  - ### invalidate

    void invalidate(K key)
    Invalidate an entry from the cache.
    Parameters:
      `key` - the key