用OSCache缓存Web页面
后台画面可用如下代码强制刷新
<filter>
<filter-name>cacheFilter</filter-name>
<filter-class>com.opensymphony.oscache.web.filter.CacheFilter</filter-class>
<init-param>
<param-name>time</param-name>
<param-value>600</param-value>
</init-param>
<init-param>
<param-name>scope</param-name>
<param-value>application</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cacheFilter</filter-name>
<url-pattern>/index.do</url-pattern>
<url-pattern>/index.shtml</url-pattern>
</filter-mapping>
后台画面可用如下代码强制刷新
import javax.servlet.jsp.PageContext;
import com.opensymphony.oscache.base.Cache;
import com.opensymphony.oscache.web.ServletCacheAdministrator;
Cache cache = ServletCacheAdministrator.getInstance(request.getSession().getServletContext()).getCache(request,
PageContext.APPLICATION_SCOPE);
cache.flushAll(new Date());
// Scope为Session时的处理
// Cache cache = ServletCacheAdministrator.getInstance(request.getSession(true).getServletContext()).getCache(request, PageContext.SESSION_SCOPE);