public abstract class Cache
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Cache.EqualByteArray
Utility class that wraps a byte array and implements the equals()
and hashCode() contract in a way suitable for Maps and caches.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Cache() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clear()
Remove all entries from the cache.
|
abstract java.lang.Object |
get(java.lang.Object key)
Get a value from the cache.
|
static Cache |
newHardMemoryCache(int size)
Return a new memory cache with the specified maximum size, unlimited
lifetime for entries, with the values held by standard references.
|
static Cache |
newHardMemoryCache(int size,
int timeout)
Return a new memory cache with the specified maximum size, the
specified maximum lifetime (in seconds), with the values held
by standard references.
|
static Cache |
newNullCache()
Return a dummy cache that does nothing.
|
static Cache |
newSoftMemoryCache(int size)
Return a new memory cache with the specified maximum size, unlimited
lifetime for entries, with the values held by SoftReferences.
|
static Cache |
newSoftMemoryCache(int size,
int timeout)
Return a new memory cache with the specified maximum size, the
specified maximum lifetime (in seconds), with the values held
by SoftReferences.
|
abstract void |
put(java.lang.Object key,
java.lang.Object value)
Add an entry to the cache.
|
abstract void |
remove(java.lang.Object key)
Remove an entry from the cache.
|
abstract int |
size()
Return the number of currently valid entries in the cache.
|
public abstract int size()
public abstract void clear()
public abstract void put(java.lang.Object key,
java.lang.Object value)
public abstract java.lang.Object get(java.lang.Object key)
public abstract void remove(java.lang.Object key)
public static Cache newSoftMemoryCache(int size)
public static Cache newSoftMemoryCache(int size, int timeout)
public static Cache newHardMemoryCache(int size)
public static Cache newNullCache()
public static Cache newHardMemoryCache(int size, int timeout)
Copyright © 2020. All Rights Reserved.