org.camunda.bpm.engine.rest.hal.cache
Class DefaultHalResourceCache

java.lang.Object
  extended by org.camunda.bpm.engine.rest.hal.cache.DefaultHalResourceCache
All Implemented Interfaces:
Cache

public class DefaultHalResourceCache
extends Object
implements Cache


Field Summary
protected  Map<String,HalResourceCacheEntry> cache
           
protected  int capacity
           
static Comparator<HalResourceCacheEntry> COMPARATOR
           
protected  long secondsToLive
           
 
Constructor Summary
DefaultHalResourceCache()
           
DefaultHalResourceCache(int capacity, long secondsToLive)
           
 
Method Summary
 void destroy()
          Destroy cache.
protected  void ensureCapacityLimit()
           
protected  boolean expired(HalResourceCacheEntry entry)
           
 Object get(String id)
          Get a resource by id.
 int getCapacity()
           
 long getSecondsToLive()
           
 void put(String id, Object resource)
          Put a resource into the cache.
 void remove(String id)
           
 void setCapacity(int capacity)
           
 void setSecondsToLive(long secondsToLive)
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPARATOR

public static final Comparator<HalResourceCacheEntry> COMPARATOR

capacity

protected int capacity

secondsToLive

protected long secondsToLive

cache

protected Map<String,HalResourceCacheEntry> cache
Constructor Detail

DefaultHalResourceCache

public DefaultHalResourceCache()

DefaultHalResourceCache

public DefaultHalResourceCache(int capacity,
                               long secondsToLive)
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(String id,
                Object resource)
Description copied from interface: Cache
Put a resource into the cache.

Specified by:
put in interface Cache
Parameters:
id - the id of the resource
resource - the resource to cache

remove

public void remove(String id)

get

public Object get(String id)
Description copied from interface: Cache
Get a resource by id.

Specified by:
get in interface Cache
Parameters:
id - the id of the resource
Returns:
the resource or null if non is found or the resource time to live expired

destroy

public void destroy()
Description copied from interface: Cache
Destroy cache.

Specified by:
destroy in interface Cache

ensureCapacityLimit

protected void ensureCapacityLimit()

expired

protected boolean expired(HalResourceCacheEntry entry)


Copyright © 2016 camunda services GmbH. All rights reserved.