using system;
using system.collections.generic;
using system.linq;
using system.web;
namespace admin.helper
return true;
} #endregion
#region get方法
///
/// 獲得指定key的快取物件
///
///
///
public static object get(string key)
return objkey;
} #endregion
#region set方法
///
/// 設定快取
///
/// cache key
/// 快取時間
/// 快取物件
public static void set(string key, datetime expiry, object obj)
objcache.insert(key, obj, null, expiry, timespan.zero);
} ///
/// 設定快取
///
/// cache key
/// 快取時間【分鐘】
/// 快取物件
public static void set(string key, int min, object obj)
#endregion
#region del方法
///
/// 刪除指定key的快取
///
///
public static void del(string key)
} #endregion
#region 其他
///
/// 獲取快取中的項數
///
public static int count
} ///
/// 獲取可用於快取的千位元組數
///
public static long privatebytes
} #endregion
} }
用方法如下:
///
/// 獲取產品詳情
///
///
///
public static productdto getproduct(string proid)
var pro = servicelocator.create().get(proid);
if (pro == null) return new productdto();
helper.cachehelper.set(key, datetime.now.addhours(8), pro);
return pro;
}
Android 清除快取輔助類的封裝
清除快取輔助類 清除cache中快取的 如果是清除資料,後期可增加 created by panda on 2020 05 07 public class clearcacheutils string formatfilesize formatfilesize filesize return for...
php封裝好的頁碼分頁類
這篇文章主要為大家詳細介紹了php封裝乙個顯示頁碼的分頁類,具有一定的參考價值,感興趣的小夥伴們可以參考一下 一 conn.php connect public function connect index.php page 1 當前頁定義為1 else this pagesize pagesize...
android清除快取封裝
time 2017 9 13 09 30 author wen description 清除快取 此方法複製到類中可直接用 public class clearcacheutils catch exception e 獲取快取大小 param context return throws except...