我在afterPropertiesSet()方法中从数据库加载一个静态列表。
在这个类中,我在很多方法中使用了静态列表,所以我不想总是从数据库加载这个列表。
代码是:
private Collection<Country> countries= null;
[...] // Use of countries in many methods
@Override
public void afterPropertiesSet() throws Exception {
// Load countries types
countries = getAddressSer
我有一个集合,其中包含大量的数据,从数据库检索。
public class Item
{
private string name_;
public string Name
{
get { return name_; }
set { name_ = value; }
}
....
}
这组数据将被用户频繁使用。在从DB中检索并在其他页面中重用后,有没有什么方法可以缓存这个集合?