com.opensymphony.oscache.web.filter
public class: ExpiresRefreshPolicy [javadoc |
source]
java.lang.Object
com.opensymphony.oscache.web.filter.ExpiresRefreshPolicy
All Implemented Interfaces:
EntryRefreshPolicy
Checks if a cache filter entry has expired.
This is useful when expires header are used in the response.
- version:
$ - Revision: 411 $
- author:
< - a href="mailto:ltorunski [ AT ] t-online.de">Lars Torunski
| Method from com.opensymphony.oscache.web.filter.ExpiresRefreshPolicy Detail: |
public long getRefreshPeriod() {
return refreshPeriod / 1000;
}
|
public boolean needsRefresh(CacheEntry entry) {
long currentTimeMillis = System.currentTimeMillis();
if ((refreshPeriod >= 0) && (currentTimeMillis >= (entry.getLastUpdate() + refreshPeriod))) {
return true;
} else if (entry.getContent() instanceof ResponseContent) {
ResponseContent responseContent = (ResponseContent) entry.getContent();
return currentTimeMillis >= responseContent.getExpires();
} else {
return false;
}
}
Indicates whether the supplied CacheEntry needs to be refreshed.
This will be called when retrieving an entry from the cache - if this method
returns true then a NeedsRefreshException will be
thrown. |
public void setRefreshPeriod(long refreshPeriod) {
this.refreshPeriod = refreshPeriod * 1000L;
}
|