|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CacheHandler
Callback interface that can be passed to
CacheService.handle(CacheHandler)
.
Field Summary | |
---|---|
static long |
CACHE_ETERNALLY
|
Method Summary | |
---|---|
String |
getCacheKey()
Returns the key that is used to look up a previously cached version. |
long |
getLastModified()
Returns the date (as timestamp) when the content was modified for the last time. |
long |
getTimeToLive()
Returns the time in milliseconds that has to be elapsed since the last up-to-date check before another check is performed. |
void |
handleUncached()
Callback method that is invoked when no CacheItem could be created. |
boolean |
updateCacheItem(CacheItem cacheItem)
Callback method that is invoked when no cached version exists or the cached content is not up-to-date. |
void |
writeCacheItem(CacheItem cacheItem)
Callback method that is invoked when an up-to-date CacheItem exists. |
Field Detail |
---|
static final long CACHE_ETERNALLY
Method Detail |
---|
String getCacheKey()
long getTimeToLive()
CACHE_ETERNALLY
to indicate that the content should be
cached eternally.
long getLastModified() throws Exception
updateCacheItem(CacheItem)
method will not be
called unless this date is newer than the timestamp of the cached
version.
Exception
void handleUncached() throws Exception
getCacheKey()
returns
null
, the cache is disabled or an unexpected error occurred.
Exception
boolean updateCacheItem(CacheItem cacheItem) throws Exception
CacheItem.getWriter()
or
CacheItem.getOutputStream()
and write their content into it.
true
if the CacheItem should be updated or
false
if it should be discarded.
Exception
void writeCacheItem(CacheItem cacheItem) throws IOException
CacheItem.writeTo(...)
to write the cached content to its destination.
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |