|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.evanmclean.evlib.cache.CacheManager
public class CacheManager
Manages a set of ConcurrentHashMapCache
caches. Caches are
thread-safe, expire entries after a specified time-to-live, can be bound to a
maximum number of entries, and can contain strong, soft or weak references to
their values.
Constructor Summary | |
---|---|
CacheManager()
Construct a cache manager with no total maximum entries. |
|
CacheManager(int max_total_entries)
Construct a cache manager with the specified total maximum entries. |
|
CacheManager(int max_total_entries,
org.slf4j.Logger log)
Construct a cache manager with the specified total maximum entries. |
|
CacheManager(org.slf4j.Logger log)
Construct a cache manager with no total maximum entries. |
Method Summary | ||
---|---|---|
CacheBuilder |
builder()
|
|
boolean |
exists(String name)
Check if a cache with a particular name exists. |
|
boolean |
expire()
Run an expiration over all managed caches. |
|
|
getCache(String name)
Returns a previously created cache. |
|
Set<String> |
getCacheNames()
Gets the list off all caches being managed. |
|
org.slf4j.Logger |
getLogger()
The logger being used (or null for no logging). |
|
int |
getMaxTotalEntries()
The total number of entries that will be held across all caches (0 for unlimited). |
|
void |
removeAllCaches()
Remove all managed caches. |
|
boolean |
removeCache(String name)
Remove the specified cache. |
|
void |
setLogger(org.slf4j.Logger log)
Set the logger to use to perform detailed logging (null for no logging). |
|
void |
setMaxTotalEntries(int max_total_entries)
Set the total number of entries that will be held across all caches (0 for unlimited). |
|
int |
size()
Total number of entries across all managed caches. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CacheManager()
public CacheManager(int max_total_entries)
max_total_entries
- The total maximum entries to be held across all caches (0 for no
overall limit).public CacheManager(int max_total_entries, org.slf4j.Logger log)
max_total_entries
- The total maximum entries to be held across all caches (0 for no
overall limit).log
- Use this logger to perform detailed logging (null for no logging).public CacheManager(org.slf4j.Logger log)
log
- Use this logger to perform detailed logging (null for no logging).Method Detail |
---|
public CacheBuilder builder()
public boolean exists(String name)
name
- Name of cache to check for.
public boolean expire()
public <K,V> ConcurrentHashMapCache<K,V> getCache(String name)
builder()
to create a new
cache.
K
- V
- name
- The name of the cache.
UnknownCacheException
- If the cache does not exist.public Set<String> getCacheNames()
public org.slf4j.Logger getLogger()
public int getMaxTotalEntries()
public void removeAllCaches()
public boolean removeCache(String name)
name
- Name of the cache to remove.
public void setLogger(org.slf4j.Logger log)
log
- Use this logger to perform detailed logging (null for no logging).public void setMaxTotalEntries(int max_total_entries)
max_total_entries
- The total number of entries that will be held across all caches (0
for unlimited).public int size()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |