我有一个不是wcf操作的方法,它进行身份验证检查
如何将其结果缓存为60秒?并且如果退出我的操作方法并且如果它不存在则使用缓存的结果执行方法以获得结果?
我想根据用户名和密码缓存此方法。
public Autenticate (UserAccount useacc)
{
............
}
public class UserAccount
{
string username, passsword, domainname;
}
答案 0 :(得分:1)
您可以查看此link进行缓存。
您可以按如下方式使用该课程。
WCFCache.Current.Insert(username, useacc, DateTime.Now.AddMinutes(1));
//get an item from the cache
user = (UserAccount )WCFCache.Current[username];