江湖救急~ asp.net 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 加静态锁,最好用单例模式 private static volatile pageCache instance = null; private static object thislock = new object();//静态锁 private pageCache() { cache = SiteCache.GetCacheService(); db = new DBTool(); } /// <summary> /// 单体模式返回当前类的实例 /// </summary> /// <returns></returns> public static pageCache GetCacheService() { if (instance == null) { lock (thislock) { if (instance == null) { instance = new pageCache(); } } } return instance; } /// <summary> /// 添除商品信息 /// </summary> public void clearCommodity() { lock (thislock) { cache.RemoveObject(_commodity_cache_path); } } /// <summary> /// 获取商品信息 /// </summary> /// <returns></returns> public DataTable getCommodity() { DataTable _list = cache.RetrieveObject(_commodity_cache_path) as DataTable; if (_list == null) { lock (thislock) { string query = "Select * From v_gl_indexCommodity "; DataTable dt = db.ExecuteTable(query, null); if (dt != null) { _list = dt; cache.AddObject(_commodity_cache_path, _list); } } } return _list; } js高手请进 求Flash图片切换效果源码 急救,请大虾们指教 iexplore。exe占用了80端口,iis没法用怎么办啊 有没有好的树 请大家看看我用asp.net开发的物流仓储系统,需要源码的朋友请加我 母版页中如何使用<%=Html.ActionLink %> 一个有关自定义控件的简单问题,初学者 关于request的程序 为什么ASP.NET的网站第一次打开这么慢啊? 一个发帖输入框 git 使用
private static volatile pageCache instance = null;
private static object thislock = new object();//静态锁
private pageCache()
{
cache = SiteCache.GetCacheService();
db = new DBTool();
}
/// <summary>
/// 单体模式返回当前类的实例
/// </summary>
/// <returns></returns>
public static pageCache GetCacheService()
{
if (instance == null)
{
lock (thislock)
{
if (instance == null)
{
instance = new pageCache();
}
}
}
return instance;
}
/// <summary>
/// 添除商品信息
/// </summary>
public void clearCommodity()
{
lock (thislock)
{
cache.RemoveObject(_commodity_cache_path);
}
}
/// <summary>
/// 获取商品信息
/// </summary>
/// <returns></returns>
public DataTable getCommodity()
{
DataTable _list = cache.RetrieveObject(_commodity_cache_path) as DataTable;
if (_list == null)
{
lock (thislock)
{
string query = "Select * From v_gl_indexCommodity ";
DataTable dt = db.ExecuteTable(query, null);
if (dt != null)
{
_list = dt;
cache.AddObject(_commodity_cache_path, _list);
}
}
}
return _list;
}