public interface Key extends Serializable
Primary contract for defining the key to an entry in the cache. Generally, the user needs to worry only about key's name and TTL related values. Others may be used internally, unless specified otherwise.
Any implementing class must override the Object.equals(Object) and
Object.hashCode() for this key to work efficiently as the cache manager sits on top of
Java's collection framework. This is mandatory so that entries can be reliably set/retrieved
to/from the cache Failing to do so will have unexpected results. My suggestion! use an already
provided implementation and don't look for creating your own. It's safe, reliable and unit
tested!
ApplicationCache| Modifier and Type | Field and Description |
|---|---|
static Long |
DEFAULT_CACHE_MAX_SIZE |
static Long |
DEFAULT_CREATION_TIME |
static String |
DEFAULT_KEY_STRING |
static Long |
DEFAULT_TTL |
static TimeUnit |
DEFAULT_TTL_TIMEUNIT |
| Modifier and Type | Method and Description |
|---|---|
Long |
getCreationTime()
Returns the creation time for an entry in the cache.
|
Object |
getKey()
Gets the key descriptor from the cache implementation.
|
void |
setCreationTime(Long creationTime)
Sets the creation time for an entry in the cache.
|
void |
setKey(Object identifier)
Sets the key descriptor to the cache implementation.
|
static final String DEFAULT_KEY_STRING
static final Long DEFAULT_TTL
static final TimeUnit DEFAULT_TTL_TIMEUNIT
static final Long DEFAULT_CREATION_TIME
static final Long DEFAULT_CACHE_MAX_SIZE
Object getKey()
Gets the key descriptor from the cache implementation.
void setKey(Object identifier)
Sets the key descriptor to the cache implementation.
identifier - the actual key identifier to be associated with an entry in the cache.Long getCreationTime()
Returns the creation time for an entry in the cache.
void setCreationTime(Long creationTime)
Sets the creation time for an entry in the cache.
creationTime - the creation time to set in millisCopyright © 2016. All rights reserved.