Package org.craftercms.core.cache
Interface CacheItem
-
- All Known Implementing Classes:
CacheItemImpl
public interface CacheItem
Provides information about an item residing in the cache.- Author:
- Sumer Jabri, Alfonso Vásquez
-
-
Field Summary
Fields Modifier and Type Field Description static long
NEVER_EXPIRE
Indicates that an item should never expire.static long
NEVER_REFRESH
Indicates that an item should never refresh.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Object
getKey()
Returns the item's key, used to identify the item within the cache.CacheLoader
getLoader()
Returns theCacheLoader
used to refresh this item.Object[]
getLoaderParams()
Returns the additional parameters required by theCacheLoader.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.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.
-
-
-
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 theCacheLoader
used 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
-
-