public interface Cache<T>
Cache
interface is used to represent a cache
that will store key value pairs. The cache exposes only several
methods to ensure that implementations can focus on performance
concerns rather than how to manage the cached values.限定符和类型 | 方法和说明 |
---|---|
void |
cache(java.lang.Object key,
T value)
This method is used to insert a key value mapping in to the
cache.
|
boolean |
contains(java.lang.Object key)
This is used to determine whether the specified key exists
with in the cache.
|
T |
fetch(java.lang.Object key)
This method is used to get the value from the cache that is
mapped to the specified key.
|
boolean |
isEmpty()
This method is used to determine if the cache is empty.
|
T |
take(java.lang.Object key)
This is used to exclusively take the value mapped to the
specified key from the cache.
|
boolean isEmpty()
void cache(java.lang.Object key, T value)
key
- this is the key to cache the provided value tovalue
- this is the value that is to be cachedT take(java.lang.Object key)
key
- this is the key to acquire the cache value withT fetch(java.lang.Object key)
key
- this is the key to acquire the cache value withboolean contains(java.lang.Object key)
key
- this is the key to check within this segment