Class DefaultHalResourceCache
- java.lang.Object
-
- org.camunda.bpm.engine.rest.hal.cache.DefaultHalResourceCache
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,HalResourceCacheEntry>
cache
protected int
capacity
static java.util.Comparator<HalResourceCacheEntry>
COMPARATOR
protected long
secondsToLive
-
Constructor Summary
Constructors Constructor Description DefaultHalResourceCache()
DefaultHalResourceCache(int capacity, long secondsToLive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
Destroy cache.protected void
ensureCapacityLimit()
protected boolean
expired(HalResourceCacheEntry entry)
java.lang.Object
get(java.lang.String id)
Get a resource by id.int
getCapacity()
long
getSecondsToLive()
void
put(java.lang.String id, java.lang.Object resource)
Put a resource into the cache.void
remove(java.lang.String id)
void
setCapacity(int capacity)
void
setSecondsToLive(long secondsToLive)
int
size()
-
-
-
Field Detail
-
COMPARATOR
public static final java.util.Comparator<HalResourceCacheEntry> COMPARATOR
-
capacity
protected int capacity
-
secondsToLive
protected long secondsToLive
-
cache
protected java.util.Map<java.lang.String,HalResourceCacheEntry> cache
-
-
Method Detail
-
getCapacity
public int getCapacity()
-
setCapacity
public void setCapacity(int capacity)
-
getSecondsToLive
public long getSecondsToLive()
-
setSecondsToLive
public void setSecondsToLive(long secondsToLive)
-
size
public int size()
-
put
public void put(java.lang.String id, java.lang.Object resource)
Description copied from interface:Cache
Put a resource into the cache.
-
remove
public void remove(java.lang.String id)
-
get
public java.lang.Object get(java.lang.String id)
Description copied from interface:Cache
Get a resource by id.
-
destroy
public void destroy()
Description copied from interface:Cache
Destroy cache.
-
ensureCapacityLimit
protected void ensureCapacityLimit()
-
expired
protected boolean expired(HalResourceCacheEntry entry)
-
-