Module waffle.jna
Package waffle.util.cache

# Class CaffeineCache<K,V>

java.lang.Object
waffle.util.cache.CaffeineCache<K,V>

Type Parameters:
  `K` - the type of keys maintained by this cache
  `V` - the type of mapped values

All Implemented Interfaces:
  `Cache<K,V>`

public class CaffeineCache<K,V> extends Object implements Cache<K,V>
A `Cache` based on `Cache`.

## Constructor Summary

Constructors
Constructor
Description
`CaffeineCache(@org.checkerframework.checker.index.qual.NonNegative long timeout)`
Instantiate new caffeine cache with timeout.

## Method Summary

Modifier and Type
Method
Description
`V`
`get(K key)`
Fetches the key from the cache.
`void`
`put(K key, V value)`
Stores a binding for the key and the value in the cache.
`void`
`remove(K key)`
Removes the binding for the key from the cache.
`int`
`size()`
Returns the number of bindings in this cache.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### CaffeineCache

public CaffeineCache(@org.checkerframework.checker.index.qual.NonNegative long timeout)
Instantiate new caffeine cache with timeout.

Parameters:
  `timeout` - Specified timeout in seconds for cache.

## Method Details

### get

public V get(K key)
Description copied from interface: `Cache`
Fetches the key from the cache.

Specified by:
  `get` in interface `Cache<K,V>`
Parameters:
  `key` - the key
Returns:
  the corresponding value
See Also:
  - `Map.get(java.lang.Object)`

### put

public void put(K key, V value)
Description copied from interface: `Cache`
Stores a binding for the key and the value in the cache.

Specified by:
  `put` in interface `Cache<K,V>`
Parameters:
  `key` - the key
  `value` - the value
See Also:
  - `Map.put(K, V)`

### remove

public void remove(K key)
Description copied from interface: `Cache`
Removes the binding for the key from the cache.

Specified by:
  `remove` in interface `Cache<K,V>`
Parameters:
  `key` - the key
See Also:
  - `Map.remove(Object)`

### size

public int size()
Description copied from interface: `Cache`
Returns the number of bindings in this cache.

Specified by:
  `size` in interface `Cache<K,V>`
Returns:
  the size
See Also:
  - `Map.size()`