You have the option to tell Hibernate which caching implementation to use by specifying the name of a class that implements org.hibernate.cache.CacheProvider using the property hibernate.cache.provider_class.
我整理了下,具体看下面的表格
Cache | Provider class | Type | Cluster Safe | Query Cache Supported |
---|---|---|---|---|
Hashtable (not intended for production use) |
org.hibernate. cache.HashtableCacheProvider |
memory | yes | |
EHCache | org.hibernate. cache.EhCacheProvider |
memory, disk | yes | |
OSCache | org.hibernate. cache.OSCacheProvider |
memory, disk | yes | |
SwarmCache | org.hibernate. cache.SwarmCacheProvider |
clustered (ip multicast) | yes (clustered invalidation) | |
JBoss TreeCache | org.hibernate. cache.TreeCacheProvider |
clustered (ip multicast), transactional | yes (replication) | yes (clock sync req.) |
复制内容到剪贴板 程序代码
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;