Package org.craftercms.core.cache
Interface CacheItem
-
- All Known Implementing Classes:
CacheItemImpl
public interface CacheItemProvides information about an item residing in the cache.- Author:
- Sumer Jabri, Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description static longNEVER_EXPIREIndicates that an item should never expire.static longNEVER_REFRESHIndicates that an item should never refresh.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectgetKey()Returns the item's key, used to identify the item within the cache.CacheLoadergetLoader()Returns theCacheLoaderused to refresh this item.Object[]getLoaderParams()Returns the additional parameters required by theCacheLoader.load(Object...)method.StringgetScope()Returns the item's scope.longgetTicksAtCreation()Returns the number of ticks that had passed at the moment the item was created.longgetTicksToExpire()Returns the number of ticks that are required for the item to expire.longgetTicksToRefresh()Returns the number of ticks the are required for the item to be refreshed.ObjectgetValue()Returns the item's value.booleanisExpired(long currentTicks)Returns true if the item has expired according to the number of ticks specified.booleanneedsRefresh(long currentTicks)Returns true if the item needs to be refreshed according to the number of ticks specified.
-
-
-
Field Detail
-
NEVER_EXPIRE
static final long NEVER_EXPIRE
Indicates that an item should never expire.- See Also:
- Constant Field Values
-
NEVER_REFRESH
static final long NEVER_REFRESH
Indicates that an item should never refresh.- See Also:
- Constant Field Values
-
-
Method Detail
-
getScope
String getScope()
Returns the item's scope.
-
getKey
Object getKey()
Returns the item's key, used to identify the item within the cache.
-
getValue
Object getValue()
Returns the item's value.
-
getTicksAtCreation
long getTicksAtCreation()
Returns the number of ticks that had passed at the moment the item was created.
-
getTicksToExpire
long getTicksToExpire()
Returns the number of ticks that are required for the item to expire.
-
getTicksToRefresh
long getTicksToRefresh()
Returns the number of ticks the are required for the item to be refreshed.
-
getLoader
CacheLoader getLoader()
Returns theCacheLoaderused to refresh this item.
-
getLoaderParams
Object[] getLoaderParams()
Returns the additional parameters required by theCacheLoader.load(Object...)method.
-
isExpired
boolean isExpired(long currentTicks)
Returns true if the item has expired according to the number of ticks specified.- Parameters:
currentTicks- the current number of ticks- Returns:
- true if the item has expired according to the number of ticks specified, false otherwise
-
needsRefresh
boolean needsRefresh(long currentTicks)
Returns true if the item needs to be refreshed according to the number of ticks specified.- Parameters:
currentTicks- the current number of ticks- Returns:
- true if the item needs to be refreshed according to the number of ticks specified, false otherwise
-
-