oscache

oscache

1、public boolean isCacheable(ServletRequest request) {
boolean cachable = false;
if (getTime() > 0) {
/**
* some AJAX application use post to get the page, need to specify a
* cache=true parameter to enable cache. Known url includes:
*/
if ("true".equals(request.getParameter("cache"))) {
cachable = true;
} else if (request.getParameter("noCache") == null
&& (request instanceof HttpServletRequest)) {
HttpServletRequest req = (HttpServletRequest) request;
String uri = req.getRequestURI();
String contextPath = req.getContextPath();
if(contextPath.length()>0)
uri = uri.substring(contextPath.length());
cachable = this.isCacheUris(uri);
}
}
return cachable;
}
public void setCacheUris(List<String> cacheUris) {
this.cacheUris = cacheUris;
}
private boolean isCacheUris(String uri){
for(String _uri:cacheUris){
if(uri.equals(_uri)){
return true;
}
}
return false;
}



2、<bean id="cacheFilterBean" class="com.ebizer.framework.core.filter.CacheFilter">
<property name="cacheUris">
  <list>
    <value>/trend.html</value>
  </list>
  </property>
</bean>

你可能感兴趣的:(oscache)