62,046
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 获取数据缓存
/// </summary>
/// <param name="key">键</param>
public static object Get(string key)
{
System.Web.Caching.Cache cache = HttpRuntime.Cache;
return cache[key];
}
/// <summary>
/// 设置数据缓存
/// </summary>
public static void Set(string key, object obj)
{
System.Web.Caching.Cache cache = HttpRuntime.Cache;
cache.Insert(key, obj);
}
如果我用cahce来实现cookies效果可以吗???例如: 每个用户登录后;我进行 Set("userid",userid);
这样可以吗???