public class SimpleCache<K, V>
extends Object
implements Cache
Thin adapter that exposes CommonCache through the internal Cache API.
K - the key typeV - the value type| Constructor and description |
|---|
SimpleCache(int limit, CacheType type)Creates a cache with the supplied size limit and eviction policy. |
SimpleCache(int limit)Creates an LRU cache with the supplied size limit. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public V |
get(K key)* Retrieves a value and updates cache state as needed. * *
|
|
public V |
getSilent(K key)* Retrieves a value using implementation-specific silent access semantics. * *
|
|
public void |
put(K key, V value)* Stores a value under the supplied key. * *
|
|
public void |
remove(K key)* Removes the value stored for the supplied key. * *
|
|
public int |
size()* Returns the current number of cached entries. * *
|
|
public String |
toString()Returns the underlying cache state as a string. |
Creates a cache with the supplied size limit and eviction policy.
limit - the maximum number of entriestype - the eviction strategyCreates an LRU cache with the supplied size limit.
limit - the maximum number of entries* Retrieves a value and updates cache state as needed. * *
key - the cache key
*null if absent* Retrieves a value using implementation-specific silent access semantics. * *
key - the cache key
*null if absent* Stores a value under the supplied key. * *
key - the cache key
*value - the cached value* Removes the value stored for the supplied key. * *
key - the cache key* Returns the current number of cached entries. * *
Returns the underlying cache state as a string.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.