| Modifier and Type | Field and Description |
|---|---|
protected Object |
key |
protected CacheLoader |
loader |
protected Object[] |
loaderParams |
protected String |
scope |
protected long |
ticksAtCreation |
protected long |
ticksToExpire |
protected long |
ticksToRefresh |
protected Object |
value |
NEVER_EXPIRE, NEVER_REFRESH| Constructor and Description |
|---|
CacheItemImpl(String scope,
long ticksAtCreation,
Object key,
Object value,
long ticksToExpire,
long ticksToRefresh,
CacheLoader loader,
Object[] loaderParams)
Value constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
Returns true if the specified
CacheItemImpl's and this instance's key and scope are equal. |
Object |
getKey()
Returns the item's key, used to identify the item within the cache.
|
CacheLoader |
getLoader()
Returns the
CacheLoader used to refresh this item. |
Object[] |
getLoaderParams()
Returns the additional parameters required by the
CacheLoader.load(Object...) method. |
String |
getScope()
Returns the item's scope.
|
long |
getTicksAtCreation()
Returns the number of ticks that had passed at the moment the item was created.
|
long |
getTicksToExpire()
Returns the number of ticks that are required for the item to expire.
|
long |
getTicksToRefresh()
Returns the number of ticks the are required for the item to be refreshed.
|
Object |
getValue()
Returns the item's value.
|
int |
hashCode() |
boolean |
isExpired(long currentTicks)
Returns true if the item has expired according to the number of ticks specified.
|
boolean |
needsRefresh(long currentTicks)
Returns true if the item needs to be refreshed according to the number of ticks specified.
|
String |
toString() |
protected final String scope
protected final long ticksAtCreation
protected final Object key
protected final Object value
protected final long ticksToExpire
protected final long ticksToRefresh
protected final CacheLoader loader
protected final Object[] loaderParams
public CacheItemImpl(String scope, long ticksAtCreation, Object key, Object value, long ticksToExpire, long ticksToRefresh, CacheLoader loader, Object[] loaderParams)
public String getScope()
public Object getKey()
public Object getValue()
public long getTicksAtCreation()
getTicksAtCreation in interface CacheItempublic long getTicksToExpire()
getTicksToExpire in interface CacheItempublic long getTicksToRefresh()
getTicksToRefresh in interface CacheItempublic CacheLoader getLoader()
CacheLoader used to refresh this item.public Object[] getLoaderParams()
CacheLoader.load(Object...) method.getLoaderParams in interface CacheItempublic boolean isExpired(long currentTicks)
public boolean needsRefresh(long currentTicks)
needsRefresh in interface CacheItemcurrentTicks - the current number of tickspublic boolean equals(Object o)
CacheItemImpl's and this instance's key and scope are equal.Copyright © 2018 CrafterCMS. All rights reserved.